diff options
Diffstat (limited to 'write-repositories-xml.py')
-rwxr-xr-x | write-repositories-xml.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/write-repositories-xml.py b/write-repositories-xml.py index 02a01bd..61cc7a0 100755 --- a/write-repositories-xml.py +++ b/write-repositories-xml.py @@ -1,7 +1,26 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # Copyright (C) 2009 Sebastian Pipping <sebastian@pipping.org> # Licensed under GPL 2 or later +import sys +import os +if len(sys.argv) > 1: + layman_global_txt_location = sys.argv[1] +else: + layman_global_txt_location = 'layman-global.txt' + +if len(sys.argv) > 2: + repositories_xml_location = sys.argv[2] +else: + repositories_xml_location = 'repositories.xml' + +if len(sys.argv) > 3: + print "USAGE:\n python %s [foo/layman-global.txt [bar/repositories.xml]]" % \ + os.path.basename(sys.argv[0]) + sys.exit(1) + + import xml.etree.ElementTree as ET import codecs @@ -24,7 +43,7 @@ def append_feed(feed_uri, overlay_object): feed.text = feed_uri overlay_object.append(feed) -a = ET.parse(open('layman-global.txt')) +a = ET.parse(open(layman_global_txt_location)) overlays = a.getroot() for overlay in overlays: @@ -120,7 +139,7 @@ overlays.attrib['version'] = '1.0' recurse_print(overlays) indent(overlays) -repositories_xml = open('repositories.xml', 'w') +repositories_xml = open(repositories_xml_location, 'w') repositories_xml.write("""\ <?xml version="1.0" encoding="UTF-8"?> <!-- $Header$ --> |