diff options
Diffstat (limited to 'src/py/buildparser')
-rwxr-xr-x | src/py/buildparser | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/py/buildparser b/src/py/buildparser index 7af980d..3007d9b 100755 --- a/src/py/buildparser +++ b/src/py/buildparser @@ -16,7 +16,8 @@ from javatoolkit.parser.buildproperties import BuildPropertiesParser from javatoolkit.parser.manifest import ManifestParser from javatoolkit.parser.tree import Node, ParseError -__author__ = ["James Le Cuirot <chewi@aura-online.co.uk>", "Karl Trygve Kalleberg <karltk@gentoo.org>"] +__author__ = ["James Le Cuirot <chewi@aura-online.co.uk>", + "Karl Trygve Kalleberg <karltk@gentoo.org>"] __version__ = "0.3.0" __productname__ = "buildparser" __description__ = "A parser for build.properties and JAR manifest files." @@ -34,14 +35,14 @@ def parse_args(): parser = OptionParser(usage, version=about) parser.add_option('-t', '--type', action='store', type='choice', - dest='type', choices=['manifest', 'buildprops'], - help='Type of file to parse: manifest or buildprops') + dest='type', choices=['manifest', 'buildprops'], + help='Type of file to parse: manifest or buildprops') parser.add_option('-i', '--in-place', action='store_true', dest='in_place', - help='Edit file in place when replacing') + help='Edit file in place when replacing') parser.add_option('-w', '--wrap', action='store_true', dest='wrap', - help='Wrap when returning singular values') + help='Wrap when returning singular values') opt, args = parser.parse_args() @@ -56,6 +57,7 @@ def parse_args(): return opt, args + def main(): opt, args = parse_args() @@ -78,7 +80,9 @@ def main(): p = BuildPropertiesParser() else: - sys.exit(__productname__ + ": error: Unknown file type. Specify using the -t option.") + sys.exit( + __productname__ + + ": error: Unknown file type. Specify using the -t option.") t = p.parse(f) f.close() @@ -89,7 +93,7 @@ def main(): if len(args) > 2: n = t.find_node(args[0]) - if n != None: + if n is not None: n.value = args[1] else: t.add_kid(Node(args[0], args[1])) @@ -105,7 +109,7 @@ def main(): elif len(args) > 1: n = t.find_node(args[0]) - if n != None: + if n is not None: if opt.wrap: print(p.wrapped_value(n)) else: @@ -115,10 +119,11 @@ def main(): for x in t.node_names(): print(x) + if __name__ == '__main__': try: main() except KeyboardInterrupt: print("Interrupted by user, aborting.") -#set expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap +# set expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap |