Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
Factor out fetching the cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Jul 13, 2010
1 parent d1a4e7a commit 5581142
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions zope/z2release/cli.py
Expand Up @@ -19,6 +19,12 @@
from zope.z2release.utils import write_index


def fetch_cfg(url, version_file):
print >>sys.stderr, 'Fetching %s' % url
data = urllib.urlopen(url).read()
file(version_file, 'w').write(data)


def main():
if len(sys.argv) != 3:
print 'Usage: z2_kgs <tag-name> <destination-dirname>'
Expand All @@ -33,10 +39,8 @@ def main():

version = tag.split('/')[-1]
versions_url = 'http://svn.zope.org/*checkout*/Zope/%s/versions.cfg' % tag
print >>sys.stderr, 'Fetching %s' % versions_url
data = urllib.urlopen(versions_url).read()
version_file = os.path.join(dirname, 'versions.cfg')
file(version_file, 'w').write(data)
fetch_cfg(versions_url, version_file)

CP = CasePreservingConfigParser()
CP.read(version_file)
Expand All @@ -54,10 +58,8 @@ def main():
if 'extends' in buildout:
extends = CP.get('buildout', 'extends')
if 'http' in extends and extends.endswith('ztk-versions.cfg'):
print >>sys.stderr, 'Fetching %s' % extends
data = urllib.urlopen(extends).read()
ztk_version_file = os.path.join(dirname, 'ztk-versions.cfg')
file(ztk_version_file, 'w').write(data)
fetch_cfg(extends, ztk_version_file)

CP2 = CasePreservingConfigParser()
CP2.read(ztk_version_file)
Expand Down

0 comments on commit 5581142

Please sign in to comment.