from optparse import OptionParser
import os
import sys
+import string
class Snippet:
for line in f:
if current == self.legal:
if line.strip() == "#": counter += 1
- else: counter = 0
- if counter == 2: current = self.doc
+ else:
+ if counter == 2: current = self.doc
+ counter = 0
if line[0] != "#": current = self.code
current.append(line)
help="Split given Makefile.rules to the original snippets")
parser.add_option("-o", "--output",
action="store", dest="output", default=False, metavar="RULES",
- help="Split given Makefile.rules to the original snippets")
+ help="Output built Makefile.rules to file RULES")
(options, args) = parser.parse_args()
return options, args
for type in ['legal', 'doc', 'code']:
for snip in parts:
- f.writelines(snip.__dict__[type])
+ if len(snip.__dict__[type]) == 0: continue
+ firstLine = string.rstrip(snip.__dict__[type][0])
+ f.write(firstLine.ljust(60)+" #@omk@%s\n"%snip.name)
+ f.writelines(snip.__dict__[type][1:])
f.close()
def main():