summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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$ -->