summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2009-10-13 00:30:46 +0200
committerSebastian Pipping <sebastian@pipping.org>2009-10-13 00:30:46 +0200
commit1749b91ef0ca88b8ea0a4c03cb64826bc8f40ffe (patch)
tree8bd0f5eb98030e637c8ea3b7b29ca132514d1064
parentImprove "generated file" note for layman-global.txt (diff)
downloadrepositories-xml-format-1749b91ef0ca88b8ea0a4c03cb64826bc8f40ffe.tar.gz
repositories-xml-format-1749b91ef0ca88b8ea0a4c03cb64826bc8f40ffe.tar.bz2
repositories-xml-format-1749b91ef0ca88b8ea0a4c03cb64826bc8f40ffe.zip
Make layman-global.txt creator script take filename parameters
-rwxr-xr-xwrite-layman-global-txt.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/write-layman-global-txt.py b/write-layman-global-txt.py
index eb009ba..209a127 100755
--- a/write-layman-global-txt.py
+++ b/write-layman-global-txt.py
@@ -2,10 +2,20 @@
# Copyright (C) 2009 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL 2 or later
+import sys
+import os
+if len(sys.argv) != 1 + 2:
+ print "USAGE:\n python %s foo/repositories.xml bar/layman-global.txt" % \
+ os.path.basename(sys.argv[0])
+ sys.exit(1)
+repositories_xml_location = sys.argv[1]
+layman_global_txt_location = sys.argv[2]
+
+
import xml.etree.ElementTree as ET
from sharedutils import * # local
-a = ET.parse(open('repositories.xml'))
+a = ET.parse(open(repositories_xml_location))
repositories = a.getroot()
for repo in repositories:
@@ -75,7 +85,7 @@ repositories.tag = 'layman'
recurse_print(repositories)
indent(repositories)
-layman_global_txt = open('layman-global.txt', 'w')
+layman_global_txt = open(layman_global_txt_location, 'w')
layman_global_txt.write("""\
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Header$ -->