Mercurial > codeOptimizer
comparison codeOptimizer.py @ 12:07e34df56b2a
Separate target for running from only conffilename.
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Wed, 14 Nov 2012 22:08:58 +0100 |
| parents | 5b542d05e2b1 |
| children | 2213edf59af4 |
comparison
equal
deleted
inserted
replaced
| 11:5b542d05e2b1 | 12:07e34df56b2a |
|---|---|
| 60 print 'Replacable lines in ' + file.path | 60 print 'Replacable lines in ' + file.path |
| 61 for r in replacable: | 61 for r in replacable: |
| 62 print str(r) + ' : ' + file.lines[r].rstrip() | 62 print str(r) + ' : ' + file.lines[r].rstrip() |
| 63 | 63 |
| 64 | 64 |
| 65 def codeOptimizerFromFilename(conffile, infiles): | |
| 66 try: | |
| 67 options = Config(conffile) | |
| 68 except: | |
| 69 print sys.argv[1] + ' is not a valid xml file' | |
| 70 sys.exit(1) | |
| 71 | |
| 72 codeOptimizer(options, infiles) | |
| 73 | |
| 74 | |
| 75 | |
| 65 if len(sys.argv) < 2: | 76 if len(sys.argv) < 2: |
| 66 usage(sys.argv[0]) | 77 usage(sys.argv[0]) |
| 67 sys.exit(1) | 78 sys.exit(1) |
| 68 | 79 |
| 69 try: | |
| 70 options = Config(sys.argv[1]) | |
| 71 except: | |
| 72 print sys.argv[1] + ' is not a valid xml file' | |
| 73 sys.exit(1) | |
| 74 | |
| 75 infiles = sys.argv[2:] | 80 infiles = sys.argv[2:] |
| 76 | 81 |
| 77 codeOptimizer(options, infiles) | 82 codeOptimizerFromFilename(sys.argv[1], infiles) |
| 78 |
