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

Commit

Permalink
Modernized z2_kgs code and updated it to work with Github.
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Mar 2, 2013
1 parent 670de39 commit 5631ff7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -4,6 +4,8 @@ Changelog
0.9 - unreleased
----------------

- Modernized `z2_kgs` code and updated it to work with Github.

- Modernized `ztk_kgs` code and skip the `zopeapp-versions` file for ZTK 2+.

0.8 - 2010-09-09
Expand Down
26 changes: 13 additions & 13 deletions src/zope/z2release/cli.py
Expand Up @@ -2,12 +2,6 @@
Generate an index file based on the version.cfg file of Zope 2
in order to provide a version specific index page generated to be used
in combination with easy_install -i <some_url>
Usage:
cli.py tags/2.12.0a3 /tmp/index/2.12.0a3
cli.py branches/2.12 /tmp/index/2.12
"""

import os
Expand All @@ -20,9 +14,14 @@


def fetch_cfg(url, version_file):
print >>sys.stderr, 'Fetching %s' % url
data = urllib.urlopen(url).read()
file(version_file, 'w').write(data)
print('Fetching %s' % url)
response = urllib.urlopen(url)
if response.code == 200:
data = response.read()
with open(version_file, 'w') as fd:
fd.write(data)
else:
raise ValueError('Failed to fetch %s' % url)


def write_versions(version_file, server, dirname):
Expand All @@ -44,19 +43,20 @@ def build_version_file(name, dirname, url, server):

def main():
if len(sys.argv) != 3:
print 'Usage: z2_kgs <tag-name> <destination-dirname>'
print 'Example: z2_kgs tags/2.12.1 /var/www/download.zope.org/Zope2/index/2.12.1/'
print('Usage: z2_kgs <tag-name> <destination-dirname>')
print('Example: z2_kgs 2.13.15 '
'/var/www/download.zope.org/Zope2/index/2.13.15/')
sys.exit(1)

tag = sys.argv[1]
dirname = sys.argv[2]
if not os.path.exists(dirname):
print >>sys.stderr, 'Creating index directory: %s' % dirname
print('Creating index directory: %s' % dirname)
os.makedirs(dirname)

server = Server('http://pypi.python.org/pypi')

url = 'http://svn.zope.org/*checkout*/Zope/%s/versions.cfg' % tag
url = 'https://raw.github.com/zopefoundation/Zope/%s/versions.cfg' % tag
CP = build_version_file('versions.cfg', dirname, url, server)

buildout = CP.options('buildout')
Expand Down

0 comments on commit 5631ff7

Please sign in to comment.