[Checkins] SVN: zope.release/trunk/ Here is the initial code. I still have to polish it, but I hope that

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Oct 9 10:55:56 EDT 2007


Log message for revision 80743:
  Here is the initial code. I still have to polish it, but I hope that 
  it will drstically reduce the KGS maintainance workflow.
  

Changed:
  A   zope.release/trunk/
  A   zope.release/trunk/.installed.cfg
  A   zope.release/trunk/bootstrap.py
  A   zope.release/trunk/buildout.cfg
  A   zope.release/trunk/controlled-packages.cfg
  A   zope.release/trunk/setup.py
  A   zope.release/trunk/src/
  A   zope.release/trunk/src/zope/
  A   zope.release/trunk/src/zope/__init__.py
  A   zope.release/trunk/src/zope/release/
  A   zope.release/trunk/src/zope/release/__init__.py
  A   zope.release/trunk/src/zope/release/buildout.cfg.in
  A   zope.release/trunk/src/zope/release/buildout.py
  A   zope.release/trunk/src/zope/release/upload.py
  A   zope.release/trunk/src/zope/release/version.py

-=-
Added: zope.release/trunk/.installed.cfg
===================================================================
--- zope.release/trunk/.installed.cfg	                        (rev 0)
+++ zope.release/trunk/.installed.cfg	2007-10-09 14:55:56 UTC (rev 80743)
@@ -0,0 +1,38 @@
+[buildout]
+installed_develop_eggs = /opt/zope/packages/zope.release/develop-eggs/zope.release.egg-link
+parts = generate-buildout generate-versions
+
+[generate-buildout]
+__buildout_installed__ = /opt/zope/packages/zope.release/bin/generate-buildout
+__buildout_signature__ = zc.recipe.egg-1.0.0b6-py2.4.egg setuptools-0.6c7-py2.4.egg zc.buildout-1.0.0b30-py2.4.egg
+_b = /opt/zope/packages/zope.release/bin
+_d = /opt/zope/packages/zope.release/develop-eggs
+_e = /opt/zope/packages/eggs
+arguments = ('controlled-packages.cfg',
+	'http://download.zope.org/zope3.4',
+	'./test-buildout.cfg')
+bin-directory = /opt/zope/packages/zope.release/bin
+develop-eggs-directory = /opt/zope/packages/zope.release/develop-eggs
+eggs = zope.release
+eggs-directory = /opt/zope/packages/eggs
+executable = /usr/bin/py24
+index = http://download.zope.org/ppix
+recipe = zc.recipe.egg:scripts
+scripts = generate-buildout
+
+[generate-versions]
+__buildout_installed__ = /opt/zope/packages/zope.release/bin/generate-versions
+__buildout_signature__ = zc.recipe.egg-1.0.0b6-py2.4.egg setuptools-0.6c7-py2.4.egg zc.buildout-1.0.0b30-py2.4.egg
+_b = /opt/zope/packages/zope.release/bin
+_d = /opt/zope/packages/zope.release/develop-eggs
+_e = /opt/zope/packages/eggs
+arguments = ('controlled-packages.cfg',
+	'./latest-versions.cfg')
+bin-directory = /opt/zope/packages/zope.release/bin
+develop-eggs-directory = /opt/zope/packages/zope.release/develop-eggs
+eggs = zope.release
+eggs-directory = /opt/zope/packages/eggs
+executable = /usr/bin/py24
+index = http://download.zope.org/ppix
+recipe = zc.recipe.egg:scripts
+scripts = generate-versions

Added: zope.release/trunk/bootstrap.py
===================================================================
--- zope.release/trunk/bootstrap.py	                        (rev 0)
+++ zope.release/trunk/bootstrap.py	2007-10-09 14:55:56 UTC (rev 80743)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id$
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                     ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+    cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+    os.P_WAIT, sys.executable, sys.executable,
+    '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+    dict(os.environ,
+         PYTHONPATH=
+         ws.find(pkg_resources.Requirement.parse('setuptools')).location
+         ),
+    ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)


Property changes on: zope.release/trunk/bootstrap.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.release/trunk/buildout.cfg
===================================================================
--- zope.release/trunk/buildout.cfg	                        (rev 0)
+++ zope.release/trunk/buildout.cfg	2007-10-09 14:55:56 UTC (rev 80743)
@@ -0,0 +1,27 @@
+[buildout]
+develop = .
+parts = generate-buildout generate-versions upload
+
+[generate-buildout]
+recipe = zc.recipe.egg:scripts
+eggs = zope.release
+scripts = generate-buildout
+arguments = ('controlled-packages.cfg',
+             'http://download.zope.org/zope3.4',
+             './test-buildout.cfg')
+
+[generate-versions]
+recipe = zc.recipe.egg:scripts
+eggs = zope.release
+scripts = generate-versions
+arguments = ('controlled-packages.cfg',
+             './latest-versions.cfg')
+
+[upload]
+recipe = zc.recipe.egg:scripts
+eggs = zope.release
+scripts = upload
+arguments = ('./test-buildout.cfg=buildout.cfg',
+             './latest-versions.cfg=versions.cfg',
+             './controlled-packages.cfg',
+             'download.zope.org:/var/www/download.zope.org/zope3.4',)

Added: zope.release/trunk/controlled-packages.cfg
===================================================================
--- zope.release/trunk/controlled-packages.cfg	                        (rev 0)
+++ zope.release/trunk/controlled-packages.cfg	2007-10-09 14:55:56 UTC (rev 80743)
@@ -0,0 +1,384 @@
+[DEFAULT]
+tested=true
+
+[ClientForm]
+tested=false
+versions = 0.2.7
+
+#[PIL]
+#tested=false
+#versions = 1.1.6
+
+[RestrictedPython]
+versions = 3.4.2
+
+[ZConfig]
+versions = 2.5
+
+[ZODB3]
+versions = 3.8.0b2
+
+[docutils]
+tested=false
+versions = 0.4
+
+[jquery.javascript]
+versions = 0.1.0c1
+
+[jquery.layer]
+versions = 0.1.0c1
+
+[lxml]
+versions = 1.3.4
+
+[mechanize]
+tested=false
+versions = 0.1.7b
+
+[pytz]
+tested=false
+versions = 2007g
+
+[setuptools]
+tested=false
+versions = 0.6c7
+
+[z3c.coverage]
+versions = 1.0.1
+
+[z3c.csvvocabulary]
+versions = 1.0.0
+
+[z3c.etestbrowser]
+versions = 1.0.3
+
+[z3c.form]
+versions = 1.6.0
+
+[z3c.formdemo]
+versions = 1.4.0
+
+[z3c.formjs]
+versions = 0.3.0
+
+[z3c.formjsdemo]
+versions = 0.3.0
+
+[z3c.formui]
+versions = 1.3.0
+
+[z3c.macro]
+versions = 1.0.0
+
+[z3c.pagelet]
+versions = 1.0.0
+
+[z3c.rml]
+versions = 0.7.1
+
+[z3c.template]
+versions = 1.1a1
+
+[z3c.traverser]
+versions = 0.2.0b1
+
+[z3c.viewlet]
+versions = 0.1.0.dev-r73473
+
+[z3c.zrtresource]
+versions = 0.1.1-r74105
+
+[zc.catalog]
+versions = 1.2b
+
+[zc.recipe.egg]
+# The zc recipes need a special environment to be tested. 
+tested = false
+versions = 1.0.0b6
+
+[zc.recipe.filestorage]
+# The zc recipes need a special environment to be tested. 
+versions = 1.0a5
+
+[zc.recipe.testrunner]
+# The zc recipes need a special environment to be tested. 
+versions = 1.0.0b8
+
+[zc.resourcelibrary]
+versions = 0.7dev-r72506
+
+[zc.table]
+versions = 0.7dev-r72459
+
+[zc.zope3recipes]
+versions = 0.6b1
+
+[zdaemon]
+versions = 2.0.0
+
+[zodbcode]
+versions = 3.4.0b1dev-r75670
+
+[zope.annotation]
+versions = 3.4.0
+
+[zope.app.apidoc]
+versions = 3.4.0a1
+
+[zope.app.applicationcontrol]
+versions = 3.4.1
+
+[zope.app.appsetup]
+versions = 3.4.1
+
+[zope.app.authentication]
+versions = 3.4.0a1
+
+[zope.app.basicskin]
+versions = 3.4.0a1
+
+[zope.app.broken]
+versions = 3.4.0a1
+
+[zope.app.catalog]
+versions = 3.4.0a2
+
+[zope.app.component]
+versions = 3.4.0b3
+
+[zope.app.container]
+versions = 3.5.0a1
+
+[zope.app.content]
+versions = 3.4.0a1
+
+[zope.app.dav]
+versions = 3.4.0a1
+
+[zope.app.debug]
+versions = 3.4.0a1
+
+[zope.app.dependable]
+versions = 3.4.0a1
+
+[zope.app.error]
+versions = 3.5.1
+
+[zope.app.exception]
+versions = 3.4.0a1
+
+[zope.app.file]
+versions = 3.4.0a1
+
+[zope.app.folder]
+versions = 3.4.0a1
+
+[zope.app.form]
+versions = 3.4.0b2
+
+[zope.app.generations]
+versions = 3.4.0a1
+
+[zope.app.http]
+versions = 3.4.0a1
+
+[zope.app.i18n]
+versions = 3.4.0a1
+
+[zope.app.interface]
+versions = 3.4.0a1
+
+[zope.app.intid]
+versions = 3.4.0a2
+
+[zope.app.keyreference]
+versions = 3.4.0a1
+
+[zope.app.locales]
+versions = 3.4.0b1.dev-r77033
+
+[zope.app.onlinehelp]
+versions = 3.4.0a1
+
+[zope.app.pagetemplate]
+versions = 3.4.0
+
+[zope.app.preference]
+versions = 3.4.0a1
+
+[zope.app.principalannotation]
+versions = 3.4.0a1
+
+[zope.app.publication]
+versions = 3.4.2
+
+[zope.app.publisher]
+versions = 3.4.0
+
+[zope.app.renderer]
+versions = 3.4.0a1
+
+[zope.app.rotterdam]
+versions = 3.4.0a1
+
+[zope.app.schema]
+versions = 3.4.0a1
+
+[zope.app.security]
+versions = 3.4.0a1-1
+
+[zope.app.securitypolicy]
+versions = 3.4.0a1
+
+[zope.app.server]
+versions = 3.4.0b1dev-r75388
+
+[zope.app.session]
+versions = 3.4.0a1
+
+[zope.app.skins]
+versions = 3.4.0a1
+
+[zope.app.testing]
+versions = 3.4.0b1-r78707
+
+[zope.app.tree]
+versions = 3.4.0a1
+
+[zope.app.twisted]
+versions = 3.4.0b1-r76119
+
+[zope.app.wsgi]
+versions = 3.4.0
+
+[zope.app.zapi]
+versions = 3.4.0a1
+
+[zope.app.zcmlfiles]
+versions = 3.4.0a1
+
+[zope.app.zopeappgenerations]
+versions = 3.4.0a1
+
+[zope.app.zptpage]
+versions = 3.4.0
+
+[zope.cachedescriptors]
+versions = 3.4.0
+
+[zope.component]
+versions = 3.4.0
+
+[zope.configuration]
+versions = 3.4.0
+
+[zope.contenttype]
+versions = 3.4.0
+
+[zope.copypastemove]
+versions = 3.4.0
+
+[zope.datetime]
+versions = 3.4.0
+
+[zope.deferredimport]
+versions = 3.4.0
+
+[zope.deprecation]
+versions = 3.4.0
+
+[zope.dottedname]
+versions = 3.4.2
+
+[zope.dublincore]
+versions = 3.4.0
+
+[zope.error]
+versions = 3.5.1
+
+[zope.event]
+versions = 3.4.0
+
+[zope.exceptions]
+versions = 3.4.0
+
+[zope.filerepresentation]
+versions = 3.4.0
+
+[zope.formlib]
+versions = 3.4.0
+
+[zope.hookable]
+versions = 3.4.0
+
+[zope.i18n]
+versions = 3.4.0
+
+[zope.i18nmessageid]
+versions = 3.4.3
+
+[zope.index]
+versions = 3.4.1
+
+[zope.interface]
+versions = 3.4.0
+
+[zope.lifecycleevent]
+versions = 3.4.0
+
+[zope.location]
+versions = 3.4.0b2
+
+[zope.minmax]
+versions = 1.0
+
+[zope.modulealias]
+versions = 3.4.0a1
+
+[zope.pagetemplate]
+versions = 3.4.0a1
+
+[zope.proxy]
+versions = 3.4.0
+
+[zope.publisher]
+versions = 3.4.1
+
+[zope.schema]
+versions = 3.4.0
+
+[zope.security]
+versions = 3.4.0b5
+
+[zope.server]
+versions = 3.5.0a2
+
+[zope.session]
+versions = 3.4.1
+
+[zope.size]
+versions = 3.4.0
+
+[zope.structuredtext]
+versions = 3.4.0
+
+[zope.tal]
+versions = 3.4.0
+
+[zope.tales]
+versions = 3.4.0
+
+[zope.testbrowser]
+versions = 3.4.1
+
+[zope.testing]
+versions = 3.5.1
+
+[zope.thread]
+versions = 3.4
+
+[zope.traversing]
+versions = 3.4.0
+
+[zope.viewlet]
+versions = 3.4dev-r73833
\ No newline at end of file

Added: zope.release/trunk/setup.py
===================================================================
--- zope.release/trunk/setup.py	                        (rev 0)
+++ zope.release/trunk/setup.py	2007-10-09 14:55:56 UTC (rev 80743)
@@ -0,0 +1,25 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Setup for ``zope.release`` project"""
+from setuptools import setup
+
+setup(
+    name='zope.release',
+    version='0.1.0',
+    package_dir = {'': 'src'},
+    entry_points = dict(console_scripts=[
+        'generate-buildout = zope.release.buildout:main',
+        'generate-versions = zope.release.version:main',
+        ])
+    )


Property changes on: zope.release/trunk/setup.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.release/trunk/src/zope/__init__.py
===================================================================
--- zope.release/trunk/src/zope/__init__.py	                        (rev 0)
+++ zope.release/trunk/src/zope/__init__.py	2007-10-09 14:55:56 UTC (rev 80743)
@@ -0,0 +1,7 @@
+# this is a namespace package
+try:
+    import pkg_resources
+    pkg_resources.declare_namespace(__name__)
+except ImportError:
+    import pkgutil
+    __path__ = pkgutil.extend_path(__path__, __name__)


Property changes on: zope.release/trunk/src/zope/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.release/trunk/src/zope/release/__init__.py
===================================================================
--- zope.release/trunk/src/zope/release/__init__.py	                        (rev 0)
+++ zope.release/trunk/src/zope/release/__init__.py	2007-10-09 14:55:56 UTC (rev 80743)
@@ -0,0 +1 @@
+# Make a package


Property changes on: zope.release/trunk/src/zope/release/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.release/trunk/src/zope/release/buildout.cfg.in
===================================================================
--- zope.release/trunk/src/zope/release/buildout.cfg.in	                        (rev 0)
+++ zope.release/trunk/src/zope/release/buildout.cfg.in	2007-10-09 14:55:56 UTC (rev 80743)
@@ -0,0 +1,11 @@
+[buildout]
+parts = test
+index = %(index-url)s
+versions = versions
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = %(tested-packages)s
+
+[versions]
+%(versions)s

Added: zope.release/trunk/src/zope/release/buildout.py
===================================================================
--- zope.release/trunk/src/zope/release/buildout.py	                        (rev 0)
+++ zope.release/trunk/src/zope/release/buildout.py	2007-10-09 14:55:56 UTC (rev 80743)
@@ -0,0 +1,94 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Generate a ``buildout.cfg`` file from the controlled list of packages.
+
+Usage: generate-buildout package-cfg-path index-url [output-cfg-path]
+
+* ``package-cfg-path``
+
+  This is the path to the controlled packages configuration file.
+
+* ``index-url``
+
+  The URL of the index to use. This is usually the index of the controlled
+  pacakges.
+
+* ``output-cfg-path``
+
+  The path of the file under which the generated buildout configuration file
+  is stored. By default it is placed in the package configuration file's
+  directory under the name 'test-buildout.cfg'.
+
+"""
+import ConfigParser
+import os
+
+def getPackagesInfo(packageConfigPath):
+    """Read all information from the controlled package configuration."""
+    config = ConfigParser.RawConfigParser()
+    config.read(packageConfigPath)
+    packages = []
+    sections = config.sections()
+    sections.sort()
+    for section in sections:
+        packages.append((
+            section,
+            config.get(section, 'versions').split(),
+            config.getboolean(section, 'tested')
+            ))
+    return packages
+
+
+def getVersionsListing(packages):
+    """Create a version listing string."""
+    return '\n'.join(
+        [name + ' = ' + version[-1]
+         for (name, version, tested) in packages])
+
+
+def generateBuildout(packageConfigPath, indexUrl, outputPath):
+    """Generate a ``buildout.cfg`` from the list of controlled packages."""
+    # Load all package information from the controlled pacakge config file.
+    packages = getPackagesInfo(packageConfigPath)
+
+    # Create the data dictionary
+    data = {
+        'index-url': indexUrl,
+        'tested-packages': '\n    '.join(
+            [p for (p, v, t) in packages if t]),
+        'versions': getVersionsListing(packages)
+        }
+
+    # Write a new buildout.cfg file
+    templatePath = os.path.join(os.path.dirname(__file__), 'buildout.cfg.in')
+    open(outputPath, 'w').write(open(templatePath, 'r').read() %data)
+
+
+def main(args=None):
+    if args is None:
+        args = sys.argv[1:]
+
+    if len(args) < 2:
+        print __file__.__doc__
+        sys.exit(1)
+
+    packageConfigPath = os.path.abspath(args[0])
+    indexUrl = args[1]
+
+    outputPath = os.path.join(
+        os.path.dirname(packageConfigPath), 'test-buildout.cfg')
+    if len(args) == 3:
+        outputPath = args[2]
+
+    generateBuildout(packageConfigPath, indexUrl, outputPath)


Property changes on: zope.release/trunk/src/zope/release/buildout.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.release/trunk/src/zope/release/upload.py
===================================================================
--- zope.release/trunk/src/zope/release/upload.py	                        (rev 0)
+++ zope.release/trunk/src/zope/release/upload.py	2007-10-09 14:55:56 UTC (rev 80743)
@@ -0,0 +1,59 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Generate a ``latest-versions.cfg`` file from the controlled list of
+packages.
+
+This file can
+
+Usage: upload file-spec1, [file-spec2, ...] dest-location
+
+* ``file-spec[N]``
+
+  This argument specifies which file to upload. The file specification has the
+  following syntax: ``<local-file-path> [ = <remote-file-name>]``
+
+  The local file path is the path to the file. Optionally you can specify the
+  name under which the file will be known remotely.
+
+* ``dest-location``
+
+  The server name and path of the remote directory.
+"""
+import os
+
+def upload(fileSpecs, destination):
+    """Generate a ``buildout.cfg`` from the list of controlled packages."""
+    for localPath, remoteName in fileSpecs:
+        destinationPath = os.path.join(destination, remoteName)
+        os.system('scp %s %s' %(localPath, destinationPath))
+
+def main(args=None):
+    if args is None:
+        args = sys.argv[1:]
+
+    if len(args) < 2:
+        print __file__.__doc__
+        sys.exit(1)
+
+    destination = args[-1]
+
+    fileSpecs = []
+    for spec in args[:-1]:
+        if '=' in spec:
+            fileSpec.append(
+                tuple([part.strip() for part in spec.split('=')]))
+        else:
+            spec = spec.strip()
+            fileSpec.append(
+                (spec, os.path.split(spec)[-1]))


Property changes on: zope.release/trunk/src/zope/release/upload.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.release/trunk/src/zope/release/version.py
===================================================================
--- zope.release/trunk/src/zope/release/version.py	                        (rev 0)
+++ zope.release/trunk/src/zope/release/version.py	2007-10-09 14:55:56 UTC (rev 80743)
@@ -0,0 +1,62 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Generate a ``latest-versions.cfg`` file from the controlled list of
+packages.
+
+This file can
+
+Usage: generate-buildout package-cfg-path [output-cfg-path]
+
+* ``package-cfg-path``
+
+  This is the path to the controlled packages configuration file.
+
+* ``output-cfg-path``
+
+  The path of the file under which the generated buildout configuration file
+  is stored. By default it is placed in the package configuration file's
+  directory under the name 'latest-versions.cfg'.
+
+"""
+import os
+
+from zope.release import buildout
+
+def generateVersions(packageConfigPath, outputPath):
+    """Generate a ``buildout.cfg`` from the list of controlled packages."""
+    # Load all package information from the controlled pacakge config file.
+    packages = buildout.getPackagesInfo(packageConfigPath)
+
+    # Write a new versions.cfg file
+    open(outputPath, 'w').write(
+        '[versions]\n' +
+        buildout.getVersionsListing(packages))
+
+
+def main(args=None):
+    if args is None:
+        args = sys.argv[1:]
+
+    if len(args) < 1:
+        print __file__.__doc__
+        sys.exit(1)
+
+    packageConfigPath = os.path.abspath(args[0])
+
+    outputPath = os.path.join(
+        os.path.dirname(packageConfigPath), 'latest-versions.cfg')
+    if len(args) == 2:
+        outputPath = args[1]
+
+    generateVersions(packageConfigPath, outputPath)


Property changes on: zope.release/trunk/src/zope/release/version.py
___________________________________________________________________
Name: svn:keywords
   + Id



More information about the Checkins mailing list