Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 29 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Include Dependency Scripts
==========================

The include dependency scripts are given a desired hierarchy of C/C++ projects and they then process
a given source directory's files for #include directives and compare the actual inclusions
(dependencies) between the different projects with the desired hierarchy.
The include dependency scripts are given a desired hierarchy of C/C++ projects
and they then process a given source directory's files for #include directives
and compare the actual inclusions (dependencies) between the different projects
with the desired hierarchy.

There are 4 scripts in this directory:
* dependencydatabase.py
Expand All @@ -19,20 +20,22 @@ And their functionality is documented below.
dependencydatabase.py
---------------------

This script processes a source directory and generates an SQLite3 database with all of the different
#include directives that it had found.
This script processes a source directory and generates an SQLite3 database with
all of the different #include directives that it had found.

This database also contains the specified project hierarchy and each file processed is associated
with its project (if known) according to the project's system path. Similarly, all the #include
directives that are found in a file are processed and associated with a project if the #include-d
file exists in that projects directory.
This database also contains the specified project hierarchy and each file
processed is associated with its project (if known) according to the project's
system path. Similarly, all the #include directives that are found in a file
are processed and associated with a project if the #include-d file exists in
that projects directory.

The database schema can be found inside of the script itself. You should refer to the script for the
most up-to-date schema information.
The database schema can be found inside of the script itself. You should refer
to the script for the most up-to-date schema information.

The script requires a configuration INI file which specifies the source directory, included and
excluded file patterns and the list of known projects. The script itself contains an example config
file which it can print on the command line:
The script requires a configuration INI file which specifies the source
directory, included and excluded file patterns and the list of known projects.
The script itself contains an example config file which it can print on the
command line:

python dependencydatabase.py --print-example-config

Expand All @@ -44,18 +47,17 @@ See help for details
dependency2html.py
------------------

This script generates an HTML report containing a dependency matrix for all the projects specified
in its INI file (which is shared and has the same format).
This script generates an HTML report containing a dependency matrix for all the
projects specified in its INI file (which is shared and has the same format).

The INI file's projects can also have their colour modified by adding the:

"css" : {
"background-color": "#99CCFF"
},
"css" : { "background-color": "#99CCFF" },

setting.

The output of the script is an HTML file with a filename specified in the INI file.
The output of the script is an HTML file with a filename specified in the INI
file.

See

Expand All @@ -66,10 +68,10 @@ for details.
dependencylist.py
-----------------

This script is intended to be used by other scripts, and generates a simple list of actual
dependencies that a particular project has. It does this by using the dependencydatabase.py script
to either generate an inmemory database, a file database or it can also use an existing database to
generate its report.
This script is intended to be used by other scripts, and generates a simple
list of actual dependencies that a particular project has. It does this by
using the dependencydatabase.py script to either generate an inmemory database,
a file database or it can also use an existing database to generate its report.

See

Expand All @@ -81,9 +83,9 @@ for details.
utility.py
----------

This script contains a bunch misc. utilities that the other scripts share and use but don't own.
Currently it only contains a Logger which standardises the way the the scripts print info, debug and
error messages.
This script contains a bunch misc. utilities that the other scripts share and
use but don't own. Currently it only contains a Logger which standardises the
way the the scripts print info, debug and error messages.

License
=======
Expand Down
Empty file modified dependency2html.py
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion dependencydatabase.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def Configure(self, argv):
if self.isConfigured:
iniPath, iniFilename = os.path.split(self.scriptIni)
self.sourcePath = toPosixPath(os.path.normpath(os.path.join(iniPath, self.sourcePath)))
print('source-path: {0}'.format(self.sourcePath))
except:
self.sourcePath = './'

Expand Down Expand Up @@ -838,12 +837,14 @@ def PrintExampleConfig():
"type": "project",
"name": "FirstProject",
"path": "Path/To/First/Project/",
"include-path": "Path/To/First/Project/include/"
"dependencies": []
},
{
"type": "project",
"name": "SecondProject",
"path": "Path/To/Second/Project/",
"include-path": "Path/To/Second/Project/include/"
"dependencies": [
"FirstProject"
]
Expand Down
6 changes: 3 additions & 3 deletions dependencylist.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def Main(argv):
graphName = "inc_dep"
if len(config.projectName) == 1:
graphName = specialNames.get(config.projectName[0], config.projectName[0])
print "digraph", graphName, "{"
print "digraph", '"{0}"'.format(graphName), "{"
if config.dotConfig is not None:
with codecs.open(config.dotConfig, 'r') as f:
contents = f.read()
Expand All @@ -206,10 +206,10 @@ def Main(argv):
wasPrinted = False
for dependency in dependencieTree[project]:
if dependency in dependencyList:
print indent, project, "->", dependency, ";"
print indent, '"{0}"'.format(project), "->", '"{0}"'.format(dependency), ";"
wasPrinted = True
if not wasPrinted:
print indent, project
print indent, '"{0}"'.format(project)
print "}"
else:
for dependency in dependencyList:
Expand Down