diff options
Diffstat (limited to 'distribution/lib/DistUtils.py')
-rw-r--r-- | distribution/lib/DistUtils.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/distribution/lib/DistUtils.py b/distribution/lib/DistUtils.py new file mode 100644 index 00000000000..a22a2f9e40d --- /dev/null +++ b/distribution/lib/DistUtils.py @@ -0,0 +1,20 @@ +import fileinput + +def commentOutLexYacc(target, makefile): + f = fileinput.input("$makefile", True) + inComment = False + inClean = False + for x in f: + if not x.startswith("\t") and x.find("$base") != -1 and x.find("$base" + ".o") == -1: + inComment = True + elif x.startswith("clean::"): + inClean = True + elif len(x.strip()) == 0: + inClean = False + inComment = False + x = x.rstrip('\n') + if (inComment or (inClean and x.find("$base") != -1)) and not x.startswith('#'): + print '#',x + else: + print x + f.close() |