From 716436a9eb56581f2be3176628f41734b1f9617b Mon Sep 17 00:00:00 2001 From: Lazar Sumar Date: Fri, 12 May 2017 10:37:27 +0100 Subject: [PATCH 1/5] Made scripts executable --- dependency2html.py | 0 dependencydatabase.py | 0 dependencylist.py | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 dependency2html.py mode change 100644 => 100755 dependencydatabase.py mode change 100644 => 100755 dependencylist.py diff --git a/dependency2html.py b/dependency2html.py old mode 100644 new mode 100755 diff --git a/dependencydatabase.py b/dependencydatabase.py old mode 100644 new mode 100755 diff --git a/dependencylist.py b/dependencylist.py old mode 100644 new mode 100755 From f75cafbf45d6c2edad451fb08bd5cd60f031657f Mon Sep 17 00:00:00 2001 From: Lazar Sumar Date: Thu, 18 May 2017 08:14:48 +0100 Subject: [PATCH 2/5] Quote the graph node names in dot Dot graphs cannot contain `-` symbols unless quoted. The simplest thing to do is to simply quote every time. --- dependencylist.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dependencylist.py b/dependencylist.py index c1e2529..44af581 100755 --- a/dependencylist.py +++ b/dependencylist.py @@ -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() @@ -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: From 75a1fee0d6d8f0af2d8ed8f7b34368a3425b646d Mon Sep 17 00:00:00 2001 From: Lazar Sumar Date: Thu, 18 May 2017 08:17:33 +0100 Subject: [PATCH 3/5] Reflow the README.md to 80 chars --- README.md | 56 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index fa2bb22..e8ea924 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 ======= From 2237dff649228e859b371421e8b2c15960e4256a Mon Sep 17 00:00:00 2001 From: Lazar Sumar Date: Thu, 18 May 2017 08:47:11 +0100 Subject: [PATCH 4/5] Remove 'source path' debug artifact --- dependencydatabase.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dependencydatabase.py b/dependencydatabase.py index 23cf28e..0b3916b 100755 --- a/dependencydatabase.py +++ b/dependencydatabase.py @@ -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 = './' From 718f564d80c0267599f5360e7575008c3b82d28c Mon Sep 17 00:00:00 2001 From: Lazar Sumar Date: Fri, 19 May 2017 09:40:31 +0100 Subject: [PATCH 5/5] Added include-path option to example config --- dependencydatabase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dependencydatabase.py b/dependencydatabase.py index 0b3916b..baa8f75 100755 --- a/dependencydatabase.py +++ b/dependencydatabase.py @@ -837,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" ]