Merge lp:~gary/launchpad/buildout1.5.0 into lp:launchpad

Proposed by Gary Poster
Status: Merged
Approved by: Aaron Bentley
Approved revision: no longer in the source branch.
Merged at revision: 11419
Proposed branch: lp:~gary/launchpad/buildout1.5.0
Merge into: lp:launchpad
Diff against target: 212 lines (+79/-27)
2 files modified
bootstrap.py (+76/-24)
versions.cfg (+3/-3)
To merge this branch: bzr merge lp:~gary/launchpad/buildout1.5.0
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Review via email: mp+33410@code.launchpad.net

Commit message

Use newest released versions of zc.buildout and friends

Description of the change

This branch moves to using a final release of zc.buildout, zc.recipe.egg, and z3c.recipe.scripts, each of which I released today.

The changes to the bootstrap script are merely copied over from the new zc.buildout's version: the file might be included from an external source if bzr had that feature.

The changes to the packages themselves were reviewed by flacoste over several branches.

Thanks

Gary

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bootstrap.py'
2--- bootstrap.py 2010-03-20 01:13:25 +0000
3+++ bootstrap.py 2010-08-23 16:12:51 +0000
4@@ -1,6 +1,6 @@
5 ##############################################################################
6 #
7-# Copyright (c) 2006 Zope Corporation and Contributors.
8+# Copyright (c) 2006 Zope Foundation and Contributors.
9 # All Rights Reserved.
10 #
11 # This software is subject to the provisions of the Zope Public License,
12@@ -16,11 +16,9 @@
13 Simply run this script in a directory containing a buildout.cfg.
14 The script accepts buildout command-line options, so you can
15 use the -c option to specify an alternate configuration file.
16-
17-$Id$
18 """
19
20-import os, shutil, sys, tempfile, textwrap, urllib, urllib2
21+import os, shutil, sys, tempfile, textwrap, urllib, urllib2, subprocess
22 from optparse import OptionParser
23
24 if sys.platform == 'win32':
25@@ -32,11 +30,23 @@
26 else:
27 quote = str
28
29+# See zc.buildout.easy_install._has_broken_dash_S for motivation and comments.
30+stdout, stderr = subprocess.Popen(
31+ [sys.executable, '-Sc',
32+ 'try:\n'
33+ ' import ConfigParser\n'
34+ 'except ImportError:\n'
35+ ' print 1\n'
36+ 'else:\n'
37+ ' print 0\n'],
38+ stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
39+has_broken_dash_S = bool(int(stdout.strip()))
40+
41 # In order to be more robust in the face of system Pythons, we want to
42 # run without site-packages loaded. This is somewhat tricky, in
43 # particular because Python 2.6's distutils imports site, so starting
44 # with the -S flag is not sufficient. However, we'll start with that:
45-if 'site' in sys.modules:
46+if not has_broken_dash_S and 'site' in sys.modules:
47 # We will restart with python -S.
48 args = sys.argv[:]
49 args[0:0] = [sys.executable, '-S']
50@@ -109,13 +119,22 @@
51 help=("Specify a directory for storing eggs. Defaults to "
52 "a temporary directory that is deleted when the "
53 "bootstrap script completes."))
54+parser.add_option("-t", "--accept-buildout-test-releases",
55+ dest='accept_buildout_test_releases',
56+ action="store_true", default=False,
57+ help=("Normally, if you do not specify a --version, the "
58+ "bootstrap script and buildout gets the newest "
59+ "*final* versions of zc.buildout and its recipes and "
60+ "extensions for you. If you use this flag, "
61+ "bootstrap and buildout will get the newest releases "
62+ "even if they are alphas or betas."))
63 parser.add_option("-c", None, action="store", dest="config_file",
64 help=("Specify the path to the buildout configuration "
65 "file to be used."))
66
67 options, args = parser.parse_args()
68
69-# if -c was provided, we push it back into args for buildout' main function
70+# if -c was provided, we push it back into args for buildout's main function
71 if options.config_file is not None:
72 args += ['-c', options.config_file]
73
74@@ -130,16 +149,15 @@
75 else:
76 options.setup_source = setuptools_source
77
78-args = args + ['bootstrap']
79-
80+if options.accept_buildout_test_releases:
81+ args.append('buildout:accept-buildout-test-releases=true')
82+args.append('bootstrap')
83
84 try:
85- to_reload = False
86 import pkg_resources
87- to_reload = True
88+ import setuptools # A flag. Sometimes pkg_resources is installed alone.
89 if not hasattr(pkg_resources, '_distribute'):
90 raise ImportError
91- import setuptools # A flag. Sometimes pkg_resources is installed alone.
92 except ImportError:
93 ez_code = urllib2.urlopen(
94 options.setup_source).read().replace('\r\n', '\n')
95@@ -151,10 +169,8 @@
96 if options.use_distribute:
97 setup_args['no_fake'] = True
98 ez['use_setuptools'](**setup_args)
99- if to_reload:
100- reload(pkg_resources)
101- else:
102- import pkg_resources
103+ reload(sys.modules['pkg_resources'])
104+ import pkg_resources
105 # This does not (always?) update the default working set. We will
106 # do it.
107 for path in sys.path:
108@@ -167,23 +183,59 @@
109 '-mqNxd',
110 quote(eggs_dir)]
111
112-if options.download_base:
113- cmd.extend(['-f', quote(options.download_base)])
114+if not has_broken_dash_S:
115+ cmd.insert(1, '-S')
116
117-requirement = 'zc.buildout'
118-if options.version:
119- requirement = '=='.join((requirement, options.version))
120-cmd.append(requirement)
121+find_links = options.download_base
122+if not find_links:
123+ find_links = os.environ.get('bootstrap-testing-find-links')
124+if find_links:
125+ cmd.extend(['-f', quote(find_links)])
126
127 if options.use_distribute:
128 setup_requirement = 'distribute'
129 else:
130 setup_requirement = 'setuptools'
131 ws = pkg_resources.working_set
132+setup_requirement_path = ws.find(
133+ pkg_resources.Requirement.parse(setup_requirement)).location
134 env = dict(
135 os.environ,
136- PYTHONPATH=ws.find(
137- pkg_resources.Requirement.parse(setup_requirement)).location)
138+ PYTHONPATH=setup_requirement_path)
139+
140+requirement = 'zc.buildout'
141+version = options.version
142+if version is None and not options.accept_buildout_test_releases:
143+ # Figure out the most recent final version of zc.buildout.
144+ import setuptools.package_index
145+ _final_parts = '*final-', '*final'
146+ def _final_version(parsed_version):
147+ for part in parsed_version:
148+ if (part[:1] == '*') and (part not in _final_parts):
149+ return False
150+ return True
151+ index = setuptools.package_index.PackageIndex(
152+ search_path=[setup_requirement_path])
153+ if find_links:
154+ index.add_find_links((find_links,))
155+ req = pkg_resources.Requirement.parse(requirement)
156+ if index.obtain(req) is not None:
157+ best = []
158+ bestv = None
159+ for dist in index[req.project_name]:
160+ distv = dist.parsed_version
161+ if _final_version(distv):
162+ if bestv is None or distv > bestv:
163+ best = [dist]
164+ bestv = distv
165+ elif distv == bestv:
166+ best.append(dist)
167+ if best:
168+ best.sort()
169+ version = best[-1].version
170+if version:
171+ requirement = '=='.join((requirement, version))
172+cmd.append(requirement)
173
174 if is_jython:
175 import subprocess
176@@ -193,7 +245,7 @@
177 if exitcode != 0:
178 sys.stdout.flush()
179 sys.stderr.flush()
180- print ("An error occured when trying to install zc.buildout. "
181+ print ("An error occurred when trying to install zc.buildout. "
182 "Look above this message for any errors that "
183 "were output by easy_install.")
184 sys.exit(exitcode)
185
186=== modified file 'versions.cfg'
187--- versions.cfg 2010-08-18 19:41:20 +0000
188+++ versions.cfg 2010-08-23 16:12:51 +0000
189@@ -101,7 +101,7 @@
190 z3c.ptcompat = 0.5.3
191 z3c.recipe.filetemplate = 2.1.0
192 z3c.recipe.i18n = 0.5.3
193-z3c.recipe.scripts = 1.0.0dev-gary-r110068
194+z3c.recipe.scripts = 1.0.0
195 z3c.recipe.tag = 0.2.0
196 z3c.rml = 0.7.3
197 z3c.skin.pagelet = 1.0.2
198@@ -111,12 +111,12 @@
199 z3c.viewlet = 1.0.0
200 z3c.viewtemplate = 0.3.2
201 z3c.zrtresource = 1.0.1
202-zc.buildout = 1.5.0dev-gary-r111190
203+zc.buildout = 1.5.0
204 zc.catalog = 1.2.0
205 zc.datetimewidget = 0.5.2
206 zc.i18n = 0.5.2
207 zc.lockfile = 1.0.0
208-zc.recipe.egg = 1.2.3dev-gary-r110068
209+zc.recipe.egg = 1.3.0
210 zc.zservertracelog = 1.1.5
211 ZConfig = 2.7.1
212 zdaemon = 2.0.4