Mercurial > codeOptimizer
diff codeOptimizer.py @ 1:a1224150b8f6
Cleanup and making code easier to read.
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Sun, 16 Sep 2012 10:35:39 +0200 |
| parents | 28b636105ed6 |
| children | 10f1d7de9bc3 |
line wrap: on
line diff
--- a/codeOptimizer.py Sat Sep 15 20:34:39 2012 +0200 +++ b/codeOptimizer.py Sun Sep 16 10:35:39 2012 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python -O -import sys, string, os, subprocess +import sys from Compilable import Compilable from DepGraph import DepGraph @@ -22,7 +22,7 @@ infiles = sys.argv[1:] -cppfiles = {} +files = {} unknown = [] flags = '-DHAS_BOOST -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_XML_LIB -DQT_SQL_LIB -O3 -Wall -I/opt/local/include -I/Users/bfg/QtSDK/Desktop/Qt/4.8.1/gcc/include -F/Users/bfg/QtSDK/Desktop/Qt/4.8.1/gcc/lib -I/Users/bfg/QtSDK/Desktop/Qt/4.8.1/gcc/include/QtOpenGL -I/Users/bfg/QtSDK/Desktop/Qt/4.8.1/gcc/include/QtXml -I/Users/bfg/QtSDK/Desktop/Qt/4.8.1/gcc/include/QtSql -I/Users/bfg/projects/dedupe' @@ -31,7 +31,7 @@ if isHppfile(file) or isCppfile(file): c = Compilable(file) c.setFlags(flags) - cppfiles[file] = c + files[file] = c else: unknown.append(file) @@ -39,8 +39,6 @@ str = ", " raise SystemExit(str.join(unknown) + " are of unknown filetype") -files = cppfiles - depgraph = DepGraph() for file in files: @@ -62,8 +60,8 @@ print 'Removable lines in ' + file.path for r in removable: print str(r) + ' : ' + file.lines[r].rstrip() - - replacable = file.replaceIncludes() + + replacable = file.replaceIncludes(dict.fromkeys(removable, '\n')) if replacable: print 'Replacable lines in ' + file.path for r in replacable:
