[Checkins] SVN: zc.sourcerelease/trunk/s Added support for passing
buildout option settings as command-line
Jim Fulton
jim at zope.com
Thu Oct 25 12:12:25 EDT 2007
Log message for revision 81106:
Added support for passing buildout option settings as command-line
options when buildoing sources to supply values normally provided by
~/.buildout/default.cfg.
Added CHANGES.txt
Changed:
U zc.sourcerelease/trunk/setup.py
A zc.sourcerelease/trunk/src/zc/sourcerelease/CHANGES.txt
U zc.sourcerelease/trunk/src/zc/sourcerelease/README.txt
U zc.sourcerelease/trunk/src/zc/sourcerelease/__init__.py
-=-
Modified: zc.sourcerelease/trunk/setup.py
===================================================================
--- zc.sourcerelease/trunk/setup.py 2007-10-25 16:04:15 UTC (rev 81105)
+++ zc.sourcerelease/trunk/setup.py 2007-10-25 16:12:25 UTC (rev 81106)
@@ -10,11 +10,15 @@
"""
long_description=(
- read('src', 'zc', 'sourcerelease', 'README.txt')
- + '\n' +
- 'Download\n'
- '**********************\n'
- )
+ '.. contents::\n\n'
+ +
+ read('src', 'zc', 'sourcerelease', 'README.txt')
+ + '\n' +
+ read('src', 'zc', 'sourcerelease', 'CHANGES.txt')
+ + '\n' +
+ 'Download\n'
+ '========\n'
+ )
open('doc.txt', 'w').write(long_description)
Added: zc.sourcerelease/trunk/src/zc/sourcerelease/CHANGES.txt
===================================================================
--- zc.sourcerelease/trunk/src/zc/sourcerelease/CHANGES.txt (rev 0)
+++ zc.sourcerelease/trunk/src/zc/sourcerelease/CHANGES.txt 2007-10-25 16:12:25 UTC (rev 81106)
@@ -0,0 +1,22 @@
+Release History
+===============
+
+0.2 (2007-10-25)
+----------------
+
+New Features
+++++++++++++
+
+Added support for passing buildout option settings as command-line
+options when buildoing sources to supply values normally provided by
+~/.buildout/default.cfg.
+
+Bugs Fixed
+++++++++++++
+
+Non-standard eggs-directory settings weren't handled correctly.
+
+0.1 (2007-10-24)
+----------------
+
+Initial release
Property changes on: zc.sourcerelease/trunk/src/zc/sourcerelease/CHANGES.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: zc.sourcerelease/trunk/src/zc/sourcerelease/README.txt
===================================================================
--- zc.sourcerelease/trunk/src/zc/sourcerelease/README.txt 2007-10-25 16:04:15 UTC (rev 81105)
+++ zc.sourcerelease/trunk/src/zc/sourcerelease/README.txt 2007-10-25 16:12:25 UTC (rev 81106)
@@ -142,8 +142,9 @@
however, we'll remove the data used by the link server:
>>> import os
+ >>> mkdir('sample_eggs_aside')
>>> for p in os.listdir(sample_eggs):
- ... remove(join(sample_eggs, p))
+ ... os.rename(join(sample_eggs, p), join('sample_eggs_aside', p))
>>> print get(link_server),
<html><body>
</body></html>
@@ -187,14 +188,33 @@
Often, we'll use file URLs for testing, but store the buildouts to be
released in a source code repository like subversion. We've created a
-simple sample. Let's try to install it:
+simple sample in subversion. Let's try to install it:
>>> print system(join('bin', 'buildout-source-release')+' '+
... 'svn://svn.zope.org/repos/main/zc.sourcerelease/svnsample'+
... ' release.cfg'),
... # doctest: +ELLIPSIS
- A ...
Creating source release.
+ ... The referenced section, 'repos', was not defined.
+
+The svnsample config, release.cfg, has::
+
+ find-links = ${repos:svnsample}
+
+Here, the expectation is that the value will be provided by a user's
+default.cfg. We'll provide a value that points to out link
+server. First, we'll put the sample eggs back on the link server:
+
+ >>> for p in os.listdir('sample_eggs_aside'):
+ ... os.rename(join('sample_eggs_aside', p), join(sample_eggs, p))
+ >>> remove('sample_eggs_aside')
+
+ >>> print system(join('bin', 'buildout-source-release')+' '+
+ ... 'svn://svn.zope.org/repos/main/zc.sourcerelease/svnsample'+
+ ... ' release.cfg'+
+ ... ' repos:svnsample='+link_server),
+ ... # doctest: +ELLIPSIS
+ Creating source release.
...
>>> ls('.')
Modified: zc.sourcerelease/trunk/src/zc/sourcerelease/__init__.py
===================================================================
--- zc.sourcerelease/trunk/src/zc/sourcerelease/__init__.py 2007-10-25 16:04:15 UTC (rev 81105)
+++ zc.sourcerelease/trunk/src/zc/sourcerelease/__init__.py 2007-10-25 16:12:25 UTC (rev 81106)
@@ -51,7 +51,16 @@
def source_release(args=None):
if args is None:
args = sys.argv[1:]
- [url, config] = args
+
+ url = args.pop(0)
+ config = args.pop(0)
+
+ clopts = []
+ for arg in args:
+ name, value = arg.split('=', 1)
+ section, option = name.split(':')
+ clopts.append((section, option, value))
+
name = url.split('/')[-1]
t1 = tempfile.mkdtemp('source-release1')
t2 = tempfile.mkdtemp('source-release2')
@@ -59,6 +68,7 @@
co2 = os.path.join(t2, name)
here = os.getcwd()
print 'Creating source release.'
+ sys.stdout.flush()
try:
if url.startswith('file://'):
@@ -69,16 +79,23 @@
cache = os.path.join(co2, 'release-distributions')
os.mkdir(cache)
buildout = zc.buildout.buildout.Buildout(
- os.path.join(co1, config), [],
- False, False, 'install',
+ os.path.join(co1, config), clopts,
+ False, False, 'bootstrap',
)
eggs_directory = buildout['buildout']['eggs-directory']
+ reggs = _relative(eggs_directory, co1)
+ if reggs is None:
+ print 'Invalid eggs directory', eggs_directory
+ sys.exit(0)
buildout.bootstrap([])
- _system(os.path.join(co1, 'bin', 'buildout'),
- '-Uvc', os.path.join(co1, config),
- 'buildout:download-cache='+cache)
+ args.extend([
+ '-Uvc', os.path.join(co1, config),
+ 'buildout:download-cache='+cache
+ ])
+
+ _system(os.path.join(co1, 'bin', 'buildout'), *args)
os.chdir(here)
@@ -86,7 +103,7 @@
dists = [env[project][0].location
for project in ('zc.buildout', 'setuptools')]
- eggs = os.path.join(co2, 'eggs')
+ eggs = os.path.join(co2, reggs)
os.mkdir(eggs)
for dist in dists:
if os.path.isdir(dist):
@@ -96,17 +113,14 @@
else:
shutil.copy(dist, eggs)
- eggs_directory = _relative(eggs_directory, co1)
- if eggs_directory is None:
- print 'Invalid eggs directory'
- sys.exit(0)
open(os.path.join(co2, 'install.py'), 'w').write(
install_template % dict(
path = [os.path.basename(dist) for dist in dists],
config = config,
version = sys.version_info[:2],
- eggs_directory = eggs_directory,
+ eggs_directory = reggs,
+ args = repr(args)[1:-1],
))
@@ -137,6 +151,7 @@
import zc.buildout.buildout
zc.buildout.buildout.main([
+ %(args)s,
'-Uc', config,
'buildout:download-cache='+os.path.join(here, 'release-distributions'),
'buildout:install-from-cache=true',
More information about the Checkins
mailing list