diff options
author | tailor <cygnus@janrain.com> | 2006-03-06 20:15:41 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2006-03-06 20:15:41 +0000 |
commit | 677fc3afb2e5a36859d6b3b94d12695ce7ae7843 (patch) | |
tree | 09dd01681bcaabae2a8c4601643ad73dc767bcdb /admin/packagexml.py | |
parent | d8b74004ed4cc3b17b61e0d56870f08550ee9b2b (diff) | |
download | php-openid-677fc3afb2e5a36859d6b3b94d12695ce7ae7843.zip php-openid-677fc3afb2e5a36859d6b3b94d12695ce7ae7843.tar.gz php-openid-677fc3afb2e5a36859d6b3b94d12695ce7ae7843.tar.bz2 |
[project @ Updated XML generation script to generate verison 1 and version 2 package XML files]
Diffstat (limited to 'admin/packagexml.py')
-rw-r--r-- | admin/packagexml.py | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/admin/packagexml.py b/admin/packagexml.py index b231c4a..89e30dc 100644 --- a/admin/packagexml.py +++ b/admin/packagexml.py @@ -3,6 +3,20 @@ import os import os.path +def makeMaintainerXML(leads): + maintainer_template = """ + <maintainer> + <user>%(user)s</user> + <name>%(name)s</name> + <email>%(email)s</email> + <role>lead</role> + </maintainer> + """ + + return "<maintainers>" + \ + "".join([maintainer_template % l for l in leads]) + \ + "</maintainers>" + def makeLeadXML(leads): lead_template = """ <lead> @@ -85,9 +99,12 @@ if __name__ == "__main__": print "Could not import XML configuration module xmlconfig" sys.exit(1) + # Expect sys.argv[2] to be the name of the XML file template to + # use for processing. try: - template_f = open(xmlconfig.template, 'r') + template_f = open(sys.argv[2], 'r') except Exception, e: + print "Usage: %s <package version> <xml template file>" % (sys.argv[0]) print "Could not open template file:", str(e) sys.exit(1) @@ -96,17 +113,24 @@ if __name__ == "__main__": try: version = sys.argv[1] except: - print "Usage: %s <package version>" % (sys.argv[0]) + print "Usage: %s <package version> <xml template file>" % (sys.argv[0]) sys.exit(2) data = xmlconfig.__dict__.copy() - contents = '<dir name="/">\n' + \ - buildContentsXML({'php': 'php'}, *xmlconfig.contents_dirs) + \ - "\n" + buildDocsXML(*xmlconfig.docs_dirs) + '\n </dir>' + contentsXml = buildContentsXML({'php': 'php'}, *xmlconfig.contents_dirs) + docsXml = buildDocsXML(*xmlconfig.docs_dirs) + + contents = '<dir name="/">\n' + contentsXml + \ + "\n" + docsXml + '\n </dir>' + + contents_v1 = '<filelist><dir name="/" baseinstalldir="Auth">\n' + contentsXml + \ + "\n" + docsXml + '\n </dir></filelist>' data['contents'] = contents + data['contents_version_1'] = contents_v1 data['leads'] = makeLeadXML(xmlconfig.leads) + data['maintainers'] = makeMaintainerXML(xmlconfig.leads) data['date'] = time.strftime("%Y-%m-%d") data['version'] = version data['uri'] = "%s%s-%s.tgz" % (data['package_base_uri'], data['package_name'], |