Status: | Merged |
---|---|
Approved by: | Jonathan Lange |
Approved revision: | 137 |
Merged at revision: | 126 |
Proposed branch: | lp:~jml/pkgme/buildout |
Merge into: | lp:pkgme |
Diff against target: |
847 lines (+552/-66) 11 files modified
.bzrignore (+6/-0) .testr.conf (+1/-1) Makefile (+18/-0) README.txt (+29/-22) bootstrap.py (+262/-0) buildout.cfg (+36/-0) buildout.mk (+80/-0) distribute_setup.py (+74/-36) sphinx.mk (+3/-3) tarmac_tests.sh (+7/-4) versions.cfg (+36/-0) |
To merge this branch: | bzr merge lp:~jml/pkgme/buildout |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jonathan Lange | Approve | ||
Review via email: mp+117924@code.launchpad.net |
Commit message
Convert pkgme to buildout. (james_w)
Description of the change
Testing things.
ISD Branch Mangler (isd-branches-mangler) wrote : | # |
The attempt to merge lp:~jml/pkgme/buildout into lp:pkgme failed. Below is the output from the failed tests.
[ -d ../download-cache ] || bzr checkout lp:ca-download-cache ../download-cache
ln -s ../download-cache download-cache
python2.7 bootstrap.py --distribute --setup-source distribute_setup.py \
--download-
--version 1.5.1
touch --no-create bin/buildout
./bin/py -m testtools.run pkgme.tests.
Tests running...
=======
ERROR: pkgme.tests.
-------
Traceback (most recent call last):
File "pkgme/
self.
File "pkgme/backend.py", line 205, in want
return self._parse_
File "pkgme/backend.py", line 168, in _parse_want_output
"returned invalid score", str(result))
WantError: Backend pkgme.tests.
=======
ERROR: pkgme.tests.
-------
Traceback (most recent call last):
File "pkgme/
self.
File "pkgme/backend.py", line 205, in want
return self._parse_
File "pkgme/backend.py", line 168, in _parse_want_output
"returned invalid score", str(result))
WantError: Backend pkgme.tests.
=======
ERROR: pkgme.tests.
-------
Traceback (most recent call last):
File "pkgme/
self.
File "pkgme/
ep(argv=argv, target_dir=cwd, interactive=False)
File "pkgme/
write_
File "pkgme/
info = get_info_for(path, allowed_
File "pkgme/backend.py", line 82, in get_info_for
return selector.
File "pkgme/backend.py", line 344, in get_info
eligble = self.get_
File "pkgme/backend.py", line 328, in get_elig...
ISD Branch Mangler (isd-branches-mangler) wrote : | # |
The attempt to merge lp:~jml/pkgme/buildout into lp:pkgme failed. Below is the output from the failed tests.
[ -d ../download-cache ] || bzr checkout lp:ca-download-cache ../download-cache
ln -s ../download-cache download-cache
./bin/py -m testtools.run pkgme.tests.
Tests running...
=======
ERROR: pkgme.tests.
-------
Traceback (most recent call last):
File "pkgme/
self.
File "pkgme/backend.py", line 205, in want
return self._parse_
File "pkgme/backend.py", line 168, in _parse_want_output
"returned invalid score", str(result))
WantError: Backend pkgme.tests.
=======
ERROR: pkgme.tests.
-------
Traceback (most recent call last):
File "pkgme/
self.
File "pkgme/backend.py", line 205, in want
return self._parse_
File "pkgme/backend.py", line 168, in _parse_want_output
"returned invalid score", str(result))
WantError: Backend pkgme.tests.
=======
ERROR: pkgme.tests.
-------
Traceback (most recent call last):
File "pkgme/
self.
File "pkgme/
ep(argv=argv, target_dir=cwd, interactive=False)
File "pkgme/
write_
File "pkgme/
info = get_info_for(path, allowed_
File "pkgme/backend.py", line 82, in get_info_for
return selector.
File "pkgme/backend.py", line 344, in get_info
eligble = self.get_
File "pkgme/backend.py", line 328, in get_eligible_
score, reason = backend.want(path)
File "pkgme/backend.py", line 205, in want
return self._parse_
File "pkgme/backend.py", line 168, in ...
- 134. By Jonathan Lange
-
Get a traceback, hopefully
- 135. By Jonathan Lange
-
What happens if we don't specify which Python?
- 136. By Jonathan Lange
-
Go back to using env.
- 137. By Jonathan Lange
-
Require argparse, since Jenkins runs tests on Python 2.6
Jonathan Lange (jml) wrote : | # |
Require argparse, float the Python version.
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2011-11-16 10:31:43 +0000 |
3 | +++ .bzrignore 2012-08-02 16:24:39 +0000 |
4 | @@ -6,3 +6,9 @@ |
5 | fixtures-0.3.5-py2.6.egg |
6 | bzr-orphans |
7 | virtualenv |
8 | +.installed.cfg |
9 | +./bin |
10 | +develop-eggs |
11 | +download-cache |
12 | +eggs |
13 | +parts |
14 | |
15 | === modified file '.testr.conf' |
16 | --- .testr.conf 2011-07-27 15:44:08 +0000 |
17 | +++ .testr.conf 2012-08-02 16:24:39 +0000 |
18 | @@ -1,3 +1,3 @@ |
19 | [DEFAULT] |
20 | -test_command=PYTHONPATH=`pwd` python -m subunit.run $IDLIST |
21 | +test_command=./bin/py -m subunit.run $IDLIST |
22 | test_id_list_default=pkgme.tests.test_suite |
23 | |
24 | === added file 'Makefile' |
25 | --- Makefile 1970-01-01 00:00:00 +0000 |
26 | +++ Makefile 2012-08-02 16:24:39 +0000 |
27 | @@ -0,0 +1,18 @@ |
28 | +# Copyright (C) 2012 Canonical Ltd. |
29 | +# |
30 | +# This program is free software: you can redistribute it and/or modify |
31 | +# it under the terms of the GNU General Public License as published by |
32 | +# the Free Software Foundation, version 3 of the License. |
33 | +# |
34 | +# This program is distributed in the hope that it will be useful, |
35 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
36 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
37 | +# GNU General Public License for more details. |
38 | +# |
39 | +# You should have received a copy of the GNU General Public License |
40 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
41 | + |
42 | +include buildout.mk |
43 | +include sphinx.mk |
44 | + |
45 | +TEST_COMMAND=$(PY) -m testtools.run pkgme.tests.test_suite |
46 | |
47 | === modified file 'README.txt' |
48 | --- README.txt 2011-12-08 15:34:02 +0000 |
49 | +++ README.txt 2012-08-02 16:24:39 +0000 |
50 | @@ -34,16 +34,34 @@ |
51 | Developers |
52 | ========== |
53 | |
54 | -Right now, the best way to hack on ``pkgme`` is in a virtualenv_. This allows |
55 | -you to hack on ``pkgme`` in a clean environment, without touching or changing |
56 | -your system Python. You will need access to the internet in order to install |
57 | -``pkgme`` into your virtualenv. On Debian/Ubuntu, make sure you have the |
58 | -`python-virtualenv` package installed, then do the following:: |
59 | - |
60 | - % virtualenv /arbitrary/path |
61 | - % source /arbitrary/path/bin/activate |
62 | - % python setup.py develop |
63 | - <hack> |
64 | +To get a development environment set up (using ``buildout``) run:: |
65 | + |
66 | + $ make bootstrap |
67 | + |
68 | +You can then run the tests with |
69 | + |
70 | + $ make check |
71 | + |
72 | +The bootstrap will fail if you have a system-wide install of buildout that |
73 | +is the same version as the one in use by this project. (You will see |
74 | +``DistributionNotFound: zc.buildout==<version>``). If you encounter |
75 | +that then you can either remove the site-wide install, or use a virtualenv |
76 | +to run the bootstrap step. |
77 | + |
78 | +You can get a shell to try code interactively by running ``./bin/py``. |
79 | + |
80 | +Buildout uses two directories as caches that can be shared between branches. |
81 | +The first is the ``download-cache`` directory. This contains all of the |
82 | +distributions of the Python dependencies. You can get this from |
83 | +``lp:ca-download-cache``, but the Makefile will grab it for you. |
84 | + |
85 | +The other directory is the ``eggs`` directory that holds built versions |
86 | +of the dependencies. |
87 | + |
88 | +The default for both of these is to symlink them from the parent directory, |
89 | +but if you wish to put them somewhere else you can set the locations with |
90 | +the ``CA_DOWNLOAD_CACHE_DIR`` and ``CA_EGGS_DIR`` environment variables. |
91 | + |
92 | |
93 | If you want to override the default location of the backends, set the |
94 | environment variable ``$PKGME_BACKEND_PATHS``. This is a colon-separated list |
95 | @@ -51,18 +69,7 @@ |
96 | |
97 | % export PKGME_BACKEND_PATHS=/pkgme/foo-backends:/pkgme/bar-backends |
98 | % cd my-about-to-be-packaged-code |
99 | - % pkgme |
100 | - |
101 | -When you're done, just run the ``deactivate`` command and blow away |
102 | -`/arbitrary/path`. |
103 | - |
104 | - |
105 | -Testing |
106 | -------- |
107 | - |
108 | -While in your virtualenv, you can run the full test suite like so:: |
109 | - |
110 | - % python setup.py test |
111 | + % ~/path/to/branch/bin/pkgme |
112 | |
113 | |
114 | Building the documentation |
115 | |
116 | === added file 'bootstrap.py' |
117 | --- bootstrap.py 1970-01-01 00:00:00 +0000 |
118 | +++ bootstrap.py 2012-08-02 16:24:39 +0000 |
119 | @@ -0,0 +1,262 @@ |
120 | +############################################################################## |
121 | +# |
122 | +# Copyright (c) 2006 Zope Foundation and Contributors. |
123 | +# All Rights Reserved. |
124 | +# |
125 | +# This software is subject to the provisions of the Zope Public License, |
126 | +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. |
127 | +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
128 | +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
129 | +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
130 | +# FOR A PARTICULAR PURPOSE. |
131 | +# |
132 | +############################################################################## |
133 | +"""Bootstrap a buildout-based project |
134 | + |
135 | +Simply run this script in a directory containing a buildout.cfg. |
136 | +The script accepts buildout command-line options, so you can |
137 | +use the -c option to specify an alternate configuration file. |
138 | +""" |
139 | + |
140 | +import os, shutil, sys, tempfile, urllib, urllib2, subprocess |
141 | +from optparse import OptionParser |
142 | + |
143 | +if sys.platform == 'win32': |
144 | + def quote(c): |
145 | + if ' ' in c: |
146 | + return '"%s"' % c # work around spawn lamosity on windows |
147 | + else: |
148 | + return c |
149 | +else: |
150 | + quote = str |
151 | + |
152 | +# See zc.buildout.easy_install._has_broken_dash_S for motivation and comments. |
153 | +stdout, stderr = subprocess.Popen( |
154 | + [sys.executable, '-Sc', |
155 | + 'try:\n' |
156 | + ' import ConfigParser\n' |
157 | + 'except ImportError:\n' |
158 | + ' print 1\n' |
159 | + 'else:\n' |
160 | + ' print 0\n'], |
161 | + stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() |
162 | +has_broken_dash_S = bool(int(stdout.strip())) |
163 | + |
164 | +# In order to be more robust in the face of system Pythons, we want to |
165 | +# run without site-packages loaded. This is somewhat tricky, in |
166 | +# particular because Python 2.6's distutils imports site, so starting |
167 | +# with the -S flag is not sufficient. However, we'll start with that: |
168 | +if not has_broken_dash_S and 'site' in sys.modules: |
169 | + # We will restart with python -S. |
170 | + args = sys.argv[:] |
171 | + args[0:0] = [sys.executable, '-S'] |
172 | + args = map(quote, args) |
173 | + os.execv(sys.executable, args) |
174 | +# Now we are running with -S. We'll get the clean sys.path, import site |
175 | +# because distutils will do it later, and then reset the path and clean |
176 | +# out any namespace packages from site-packages that might have been |
177 | +# loaded by .pth files. |
178 | +clean_path = sys.path[:] |
179 | +import site # imported because of its side effects |
180 | +sys.path[:] = clean_path |
181 | +for k, v in sys.modules.items(): |
182 | + if k in ('setuptools', 'pkg_resources') or ( |
183 | + hasattr(v, '__path__') and |
184 | + len(v.__path__) == 1 and |
185 | + not os.path.exists(os.path.join(v.__path__[0], '__init__.py'))): |
186 | + # This is a namespace package. Remove it. |
187 | + sys.modules.pop(k) |
188 | + |
189 | +is_jython = sys.platform.startswith('java') |
190 | + |
191 | +setuptools_source = 'http://peak.telecommunity.com/dist/ez_setup.py' |
192 | +distribute_source = 'http://python-distribute.org/distribute_setup.py' |
193 | + |
194 | + |
195 | +# parsing arguments |
196 | +def normalize_to_url(option, opt_str, value, parser): |
197 | + if value: |
198 | + if '://' not in value: # It doesn't smell like a URL. |
199 | + value = 'file://%s' % ( |
200 | + urllib.pathname2url( |
201 | + os.path.abspath(os.path.expanduser(value))),) |
202 | + if opt_str == '--download-base' and not value.endswith('/'): |
203 | + # Download base needs a trailing slash to make the world happy. |
204 | + value += '/' |
205 | + else: |
206 | + value = None |
207 | + name = opt_str[2:].replace('-', '_') |
208 | + setattr(parser.values, name, value) |
209 | + |
210 | +usage = '''\ |
211 | +[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] |
212 | + |
213 | +Bootstraps a buildout-based project. |
214 | + |
215 | +Simply run this script in a directory containing a buildout.cfg, using the |
216 | +Python that you want bin/buildout to use. |
217 | + |
218 | +Note that by using --setup-source and --download-base to point to |
219 | +local resources, you can keep this script from going over the network. |
220 | +''' |
221 | + |
222 | +parser = OptionParser(usage=usage) |
223 | +parser.add_option("-v", "--version", dest="version", |
224 | + help="use a specific zc.buildout version") |
225 | +parser.add_option("-d", "--distribute", |
226 | + action="store_true", dest="use_distribute", default=False, |
227 | + help="Use Distribute rather than Setuptools.") |
228 | +parser.add_option("--setup-source", action="callback", dest="setup_source", |
229 | + callback=normalize_to_url, nargs=1, type="string", |
230 | + help=("Specify a URL or file location for the setup file. " |
231 | + "If you use Setuptools, this will default to " + |
232 | + setuptools_source + "; if you use Distribute, this " |
233 | + "will default to " + distribute_source + ".")) |
234 | +parser.add_option("--download-base", action="callback", dest="download_base", |
235 | + callback=normalize_to_url, nargs=1, type="string", |
236 | + help=("Specify a URL or directory for downloading " |
237 | + "zc.buildout and either Setuptools or Distribute. " |
238 | + "Defaults to PyPI.")) |
239 | +parser.add_option("--eggs", |
240 | + help=("Specify a directory for storing eggs. Defaults to " |
241 | + "a temporary directory that is deleted when the " |
242 | + "bootstrap script completes.")) |
243 | +parser.add_option("-t", "--accept-buildout-test-releases", |
244 | + dest='accept_buildout_test_releases', |
245 | + action="store_true", default=False, |
246 | + help=("Normally, if you do not specify a --version, the " |
247 | + "bootstrap script and buildout gets the newest " |
248 | + "*final* versions of zc.buildout and its recipes and " |
249 | + "extensions for you. If you use this flag, " |
250 | + "bootstrap and buildout will get the newest releases " |
251 | + "even if they are alphas or betas.")) |
252 | +parser.add_option("-c", None, action="store", dest="config_file", |
253 | + help=("Specify the path to the buildout configuration " |
254 | + "file to be used.")) |
255 | + |
256 | +options, args = parser.parse_args() |
257 | + |
258 | +# if -c was provided, we push it back into args for buildout's main function |
259 | +if options.config_file is not None: |
260 | + args += ['-c', options.config_file] |
261 | + |
262 | +if options.eggs: |
263 | + eggs_dir = os.path.abspath(os.path.expanduser(options.eggs)) |
264 | +else: |
265 | + eggs_dir = tempfile.mkdtemp() |
266 | + |
267 | +if options.setup_source is None: |
268 | + if options.use_distribute: |
269 | + options.setup_source = distribute_source |
270 | + else: |
271 | + options.setup_source = setuptools_source |
272 | + |
273 | +if options.accept_buildout_test_releases: |
274 | + args.append('buildout:accept-buildout-test-releases=true') |
275 | +args.append('bootstrap') |
276 | + |
277 | +try: |
278 | + import pkg_resources |
279 | + import setuptools # A flag. Sometimes pkg_resources is installed alone. |
280 | + if not hasattr(pkg_resources, '_distribute'): |
281 | + raise ImportError |
282 | +except ImportError: |
283 | + ez_code = urllib2.urlopen( |
284 | + options.setup_source).read().replace('\r\n', '\n') |
285 | + ez = {} |
286 | + exec ez_code in ez |
287 | + setup_args = dict(to_dir=eggs_dir, download_delay=0) |
288 | + if options.download_base: |
289 | + setup_args['download_base'] = options.download_base |
290 | + if options.use_distribute: |
291 | + setup_args['no_fake'] = True |
292 | + ez['use_setuptools'](**setup_args) |
293 | + if 'pkg_resources' in sys.modules: |
294 | + reload(sys.modules['pkg_resources']) |
295 | + import pkg_resources |
296 | + # This does not (always?) update the default working set. We will |
297 | + # do it. |
298 | + for path in sys.path: |
299 | + if path not in pkg_resources.working_set.entries: |
300 | + pkg_resources.working_set.add_entry(path) |
301 | + |
302 | +cmd = [quote(sys.executable), |
303 | + '-c', |
304 | + quote('from setuptools.command.easy_install import main; main()'), |
305 | + '-mqNxd', |
306 | + quote(eggs_dir)] |
307 | + |
308 | +if not has_broken_dash_S: |
309 | + cmd.insert(1, '-S') |
310 | + |
311 | +find_links = options.download_base |
312 | +if not find_links: |
313 | + find_links = os.environ.get('bootstrap-testing-find-links') |
314 | +if find_links: |
315 | + cmd.extend(['-f', quote(find_links)]) |
316 | + |
317 | +if options.use_distribute: |
318 | + setup_requirement = 'distribute' |
319 | +else: |
320 | + setup_requirement = 'setuptools' |
321 | +ws = pkg_resources.working_set |
322 | +setup_requirement_path = ws.find( |
323 | + pkg_resources.Requirement.parse(setup_requirement)).location |
324 | +env = dict( |
325 | + os.environ, |
326 | + PYTHONPATH=setup_requirement_path) |
327 | + |
328 | +requirement = 'zc.buildout' |
329 | +version = options.version |
330 | +if version is None and not options.accept_buildout_test_releases: |
331 | + # Figure out the most recent final version of zc.buildout. |
332 | + import setuptools.package_index |
333 | + _final_parts = '*final-', '*final' |
334 | + |
335 | + def _final_version(parsed_version): |
336 | + for part in parsed_version: |
337 | + if (part[:1] == '*') and (part not in _final_parts): |
338 | + return False |
339 | + return True |
340 | + index = setuptools.package_index.PackageIndex( |
341 | + search_path=[setup_requirement_path]) |
342 | + if find_links: |
343 | + index.add_find_links((find_links,)) |
344 | + req = pkg_resources.Requirement.parse(requirement) |
345 | + if index.obtain(req) is not None: |
346 | + best = [] |
347 | + bestv = None |
348 | + for dist in index[req.project_name]: |
349 | + distv = dist.parsed_version |
350 | + if _final_version(distv): |
351 | + if bestv is None or distv > bestv: |
352 | + best = [dist] |
353 | + bestv = distv |
354 | + elif distv == bestv: |
355 | + best.append(dist) |
356 | + if best: |
357 | + best.sort() |
358 | + version = best[-1].version |
359 | +if version: |
360 | + requirement = '=='.join((requirement, version)) |
361 | +cmd.append(requirement) |
362 | + |
363 | +if is_jython: |
364 | + import subprocess |
365 | + exitcode = subprocess.Popen(cmd, env=env).wait() |
366 | +else: # Windows prefers this, apparently; otherwise we would prefer subprocess |
367 | + exitcode = os.spawnle(*([os.P_WAIT, sys.executable] + cmd + [env])) |
368 | +if exitcode != 0: |
369 | + sys.stdout.flush() |
370 | + sys.stderr.flush() |
371 | + print ("An error occurred when trying to install zc.buildout. " |
372 | + "Look above this message for any errors that " |
373 | + "were output by easy_install.") |
374 | + sys.exit(exitcode) |
375 | + |
376 | +ws.add_entry(eggs_dir) |
377 | +ws.require(requirement) |
378 | +import zc.buildout.buildout |
379 | +zc.buildout.buildout.main(args) |
380 | +if not options.eggs: # clean up temporary egg directory |
381 | + shutil.rmtree(eggs_dir) |
382 | |
383 | === added file 'buildout.cfg' |
384 | --- buildout.cfg 1970-01-01 00:00:00 +0000 |
385 | +++ buildout.cfg 2012-08-02 16:24:39 +0000 |
386 | @@ -0,0 +1,36 @@ |
387 | +# Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
388 | +# GNU Affero General Public License version 3 (see the file LICENSE). |
389 | + |
390 | +[buildout] |
391 | +parts = |
392 | + scripts |
393 | +unzip = true |
394 | +eggs-directory = eggs |
395 | +download-cache = download-cache |
396 | +relative-paths = true |
397 | + |
398 | +# Disable this option temporarily if you want buildout to find software |
399 | +# dependencies *other* than those in our download-cache. Once you have the |
400 | +# desired software, reenable this option (and check in the new software to |
401 | +# lp:ca-dependencies if this is going to be reviewed/merged/deployed.) |
402 | +install-from-cache = true |
403 | + |
404 | +# This also will need to be temporarily disabled or changed for package |
405 | +# upgrades. Newly-added packages should also add their desired version number |
406 | +# to versions.cfg. |
407 | +extends = versions.cfg |
408 | + |
409 | +allow-picked-versions = false |
410 | + |
411 | +prefer-final = true |
412 | + |
413 | +develop = . |
414 | + |
415 | +[scripts] |
416 | +recipe = z3c.recipe.scripts |
417 | +# Test dependencies get added here |
418 | +# python-subunit is needed for those that use testr |
419 | +eggs = pkgme |
420 | + python-subunit |
421 | +include-site-packages = false |
422 | +interpreter = py |
423 | |
424 | === added file 'buildout.mk' |
425 | --- buildout.mk 1970-01-01 00:00:00 +0000 |
426 | +++ buildout.mk 2012-08-02 16:24:39 +0000 |
427 | @@ -0,0 +1,80 @@ |
428 | +# Copyright (C) 2012 Canonical Ltd. |
429 | +# |
430 | +# This program is free software: you can redistribute it and/or modify |
431 | +# it under the terms of the GNU General Public License as published by |
432 | +# the Free Software Foundation, version 3 of the License. |
433 | +# |
434 | +# This program is distributed in the hope that it will be useful, |
435 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
436 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
437 | +# GNU General Public License for more details. |
438 | +# |
439 | +# You should have received a copy of the GNU General Public License |
440 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
441 | + |
442 | +EXTERNAL_PY?=python |
443 | +PY=./bin/py |
444 | + |
445 | +EXTERNAL_BUILDOUT?=$(EXTERNAL_PY) bootstrap.py |
446 | +BUILDOUT=./bin/buildout |
447 | + |
448 | +CA_EGGS_DIR?=../eggs |
449 | +CA_DOWNLOAD_CACHE_DIR?=../download-cache |
450 | + |
451 | +clean: |
452 | + $(RM) -r bin |
453 | + $(RM) -r develop-eggs |
454 | +ifeq ($(CA_EGGS_DIR),eggs) |
455 | + $(RM) -r eggs |
456 | +else |
457 | + $(RM) eggs |
458 | +endif |
459 | +ifeq ($(CA_DOWNLOAD_CACHE_DIR),download-cache) |
460 | + $(RM) -r download-cache |
461 | +else |
462 | + $(RM) download-cache |
463 | +endif |
464 | + $(RM) -r parts |
465 | + $(RM) -r .installed.cfg |
466 | + |
467 | +eggs: |
468 | +ifeq ($(CA_EGGS_DIR),$@) |
469 | + mkdir $@ |
470 | +else |
471 | + [ -d $(CA_EGGS_DIR) ] || mkdir $(CA_EGGS_DIR) |
472 | + ln -s $(CA_EGGS_DIR) $@ |
473 | +endif |
474 | + |
475 | +download-cache: |
476 | +ifeq ($(CA_DOWNLOAD_CACHE_DIR),$@) |
477 | + bzr checkout lp:ca-download-cache $@ |
478 | +else |
479 | + [ -d $(CA_DOWNLOAD_CACHE_DIR) ] || bzr checkout lp:ca-download-cache $(CA_DOWNLOAD_CACHE_DIR) |
480 | + ln -s $(CA_DOWNLOAD_CACHE_DIR) $@ |
481 | +endif |
482 | + |
483 | +$(BUILDOUT): bootstrap.py distribute_setup.py eggs download-cache |
484 | + $(EXTERNAL_BUILDOUT) --distribute --setup-source distribute_setup.py \ |
485 | + --download-base=download-cache/dist --eggs=eggs \ |
486 | + --version 1.5.1 |
487 | + touch --no-create $@ |
488 | + |
489 | +$(PY): $(BUILDOUT) |
490 | + $(BUILDOUT) |
491 | + touch --no-create $@ |
492 | + |
493 | +bootstrap: clean $(PY) |
494 | + |
495 | +test: $(PY) |
496 | + $(TEST_COMMAND) |
497 | + |
498 | +check: test |
499 | + |
500 | +# Can be used to update the dependencies when you change something |
501 | +# in versions.cfg. |
502 | +update-deps: $(BUILDOUT) |
503 | + $(BUILDOUT) buildout:install-from-cache=false |
504 | + |
505 | + |
506 | +.PHONY: bootstrap test check clean fetch-deps |
507 | +.DEFAULT_GOAL := $(PY) |
508 | |
509 | === modified file 'distribute_setup.py' |
510 | --- distribute_setup.py 2010-11-10 22:19:38 +0000 |
511 | +++ distribute_setup.py 2012-08-02 16:24:39 +0000 |
512 | @@ -46,7 +46,7 @@ |
513 | args = [quote(arg) for arg in args] |
514 | return os.spawnl(os.P_WAIT, sys.executable, *args) == 0 |
515 | |
516 | -DEFAULT_VERSION = "0.6.10" |
517 | +DEFAULT_VERSION = "0.6.28" |
518 | DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/" |
519 | SETUPTOOLS_FAKED_VERSION = "0.6c11" |
520 | |
521 | @@ -63,7 +63,7 @@ |
522 | """ % SETUPTOOLS_FAKED_VERSION |
523 | |
524 | |
525 | -def _install(tarball): |
526 | +def _install(tarball, install_args=()): |
527 | # extracting the tarball |
528 | tmpdir = tempfile.mkdtemp() |
529 | log.warn('Extracting in %s', tmpdir) |
530 | @@ -81,7 +81,7 @@ |
531 | |
532 | # installing |
533 | log.warn('Installing Distribute') |
534 | - if not _python_cmd('setup.py', 'install'): |
535 | + if not _python_cmd('setup.py', 'install', *install_args): |
536 | log.warn('Something went wrong during the installation.') |
537 | log.warn('See the error message above.') |
538 | finally: |
539 | @@ -144,7 +144,7 @@ |
540 | except ImportError: |
541 | return _do_download(version, download_base, to_dir, download_delay) |
542 | try: |
543 | - pkg_resources.require("distribute>="+version) |
544 | + pkg_resources.require("distribute>=" + version) |
545 | return |
546 | except pkg_resources.VersionConflict: |
547 | e = sys.exc_info()[1] |
548 | @@ -167,6 +167,7 @@ |
549 | if not no_fake: |
550 | _create_fake_setuptools_pkg_info(to_dir) |
551 | |
552 | + |
553 | def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, |
554 | to_dir=os.curdir, delay=15): |
555 | """Download distribute from a specified location and return its filename |
556 | @@ -204,6 +205,31 @@ |
557 | return os.path.realpath(saveto) |
558 | |
559 | |
560 | +def _no_sandbox(function): |
561 | + def __no_sandbox(*args, **kw): |
562 | + try: |
563 | + from setuptools.sandbox import DirectorySandbox |
564 | + if not hasattr(DirectorySandbox, '_old'): |
565 | + def violation(*args): |
566 | + pass |
567 | + DirectorySandbox._old = DirectorySandbox._violation |
568 | + DirectorySandbox._violation = violation |
569 | + patched = True |
570 | + else: |
571 | + patched = False |
572 | + except ImportError: |
573 | + patched = False |
574 | + |
575 | + try: |
576 | + return function(*args, **kw) |
577 | + finally: |
578 | + if patched: |
579 | + DirectorySandbox._violation = DirectorySandbox._old |
580 | + del DirectorySandbox._old |
581 | + |
582 | + return __no_sandbox |
583 | + |
584 | + |
585 | def _patch_file(path, content): |
586 | """Will backup the file then patch it""" |
587 | existing_content = open(path).read() |
588 | @@ -220,38 +246,20 @@ |
589 | f.close() |
590 | return True |
591 | |
592 | +_patch_file = _no_sandbox(_patch_file) |
593 | + |
594 | |
595 | def _same_content(path, content): |
596 | return open(path).read() == content |
597 | |
598 | -def _no_sandbox(function): |
599 | - def __no_sandbox(*args, **kw): |
600 | - try: |
601 | - from setuptools.sandbox import DirectorySandbox |
602 | - def violation(*args): |
603 | - pass |
604 | - DirectorySandbox._old = DirectorySandbox._violation |
605 | - DirectorySandbox._violation = violation |
606 | - patched = True |
607 | - except ImportError: |
608 | - patched = False |
609 | - |
610 | - try: |
611 | - return function(*args, **kw) |
612 | - finally: |
613 | - if patched: |
614 | - DirectorySandbox._violation = DirectorySandbox._old |
615 | - del DirectorySandbox._old |
616 | - |
617 | - return __no_sandbox |
618 | - |
619 | -@_no_sandbox |
620 | + |
621 | def _rename_path(path): |
622 | new_name = path + '.OLD.%s' % time.time() |
623 | log.warn('Renaming %s into %s', path, new_name) |
624 | os.rename(path, new_name) |
625 | return new_name |
626 | |
627 | + |
628 | def _remove_flat_installation(placeholder): |
629 | if not os.path.isdir(placeholder): |
630 | log.warn('Unkown installation at %s', placeholder) |
631 | @@ -285,13 +293,15 @@ |
632 | 'Setuptools distribution', element) |
633 | return True |
634 | |
635 | +_remove_flat_installation = _no_sandbox(_remove_flat_installation) |
636 | + |
637 | |
638 | def _after_install(dist): |
639 | log.warn('After install bootstrap.') |
640 | placeholder = dist.get_command_obj('install').install_purelib |
641 | _create_fake_setuptools_pkg_info(placeholder) |
642 | |
643 | -@_no_sandbox |
644 | + |
645 | def _create_fake_setuptools_pkg_info(placeholder): |
646 | if not placeholder or not os.path.exists(placeholder): |
647 | log.warn('Could not find the install location') |
648 | @@ -304,6 +314,9 @@ |
649 | log.warn('%s already exists', pkg_info) |
650 | return |
651 | |
652 | + if not os.access(pkg_info, os.W_OK): |
653 | + log.warn("Don't have permissions to write %s, skipping", pkg_info) |
654 | + |
655 | log.warn('Creating %s', pkg_info) |
656 | f = open(pkg_info, 'w') |
657 | try: |
658 | @@ -319,6 +332,11 @@ |
659 | finally: |
660 | f.close() |
661 | |
662 | +_create_fake_setuptools_pkg_info = _no_sandbox( |
663 | + _create_fake_setuptools_pkg_info |
664 | +) |
665 | + |
666 | + |
667 | def _patch_egg_dir(path): |
668 | # let's check if it's already patched |
669 | pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO') |
670 | @@ -337,6 +355,8 @@ |
671 | f.close() |
672 | return True |
673 | |
674 | +_patch_egg_dir = _no_sandbox(_patch_egg_dir) |
675 | + |
676 | |
677 | def _before_install(): |
678 | log.warn('Before install bootstrap.') |
679 | @@ -346,7 +366,7 @@ |
680 | def _under_prefix(location): |
681 | if 'install' not in sys.argv: |
682 | return True |
683 | - args = sys.argv[sys.argv.index('install')+1:] |
684 | + args = sys.argv[sys.argv.index('install') + 1:] |
685 | for index, arg in enumerate(args): |
686 | for option in ('--root', '--prefix'): |
687 | if arg.startswith('%s=' % option): |
688 | @@ -354,10 +374,10 @@ |
689 | return location.startswith(top_dir) |
690 | elif arg == option: |
691 | if len(args) > index: |
692 | - top_dir = args[index+1] |
693 | + top_dir = args[index + 1] |
694 | return location.startswith(top_dir) |
695 | - elif option == '--user' and USER_SITE is not None: |
696 | - return location.startswith(USER_SITE) |
697 | + if arg == '--user' and USER_SITE is not None: |
698 | + return location.startswith(USER_SITE) |
699 | return True |
700 | |
701 | |
702 | @@ -371,11 +391,14 @@ |
703 | return |
704 | ws = pkg_resources.working_set |
705 | try: |
706 | - setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools', |
707 | - replacement=False)) |
708 | + setuptools_dist = ws.find( |
709 | + pkg_resources.Requirement.parse('setuptools', replacement=False) |
710 | + ) |
711 | except TypeError: |
712 | # old distribute API |
713 | - setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools')) |
714 | + setuptools_dist = ws.find( |
715 | + pkg_resources.Requirement.parse('setuptools') |
716 | + ) |
717 | |
718 | if setuptools_dist is None: |
719 | log.warn('No setuptools distribution found') |
720 | @@ -416,6 +439,10 @@ |
721 | def _relaunch(): |
722 | log.warn('Relaunching...') |
723 | # we have to relaunch the process |
724 | + # pip marker to avoid a relaunch bug |
725 | + _cmd = ['-c', 'install', '--single-version-externally-managed'] |
726 | + if sys.argv[:3] == _cmd: |
727 | + sys.argv[0] = 'setup.py' |
728 | args = [sys.executable] + sys.argv |
729 | sys.exit(subprocess.call(args)) |
730 | |
731 | @@ -440,7 +467,7 @@ |
732 | # Extract directories with a safe mode. |
733 | directories.append(tarinfo) |
734 | tarinfo = copy.copy(tarinfo) |
735 | - tarinfo.mode = 448 # decimal for oct 0700 |
736 | + tarinfo.mode = 448 # decimal for oct 0700 |
737 | self.extract(tarinfo, path) |
738 | |
739 | # Reverse sort directories. |
740 | @@ -467,10 +494,21 @@ |
741 | self._dbg(1, "tarfile: %s" % e) |
742 | |
743 | |
744 | +def _build_install_args(argv): |
745 | + install_args = [] |
746 | + user_install = '--user' in argv |
747 | + if user_install and sys.version_info < (2, 6): |
748 | + log.warn("--user requires Python 2.6 or later") |
749 | + raise SystemExit(1) |
750 | + if user_install: |
751 | + install_args.append('--user') |
752 | + return install_args |
753 | + |
754 | + |
755 | def main(argv, version=DEFAULT_VERSION): |
756 | """Install or upgrade setuptools and EasyInstall""" |
757 | tarball = download_setuptools() |
758 | - _install(tarball) |
759 | + _install(tarball, _build_install_args(argv)) |
760 | |
761 | |
762 | if __name__ == '__main__': |
763 | |
764 | === renamed file 'Makefile' => 'sphinx.mk' |
765 | --- Makefile 2010-11-10 22:42:51 +0000 |
766 | +++ sphinx.mk 2012-08-02 16:24:39 +0000 |
767 | @@ -11,9 +11,9 @@ |
768 | PAPEROPT_letter = -D latex_paper_size=letter |
769 | ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
770 | |
771 | -.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest |
772 | +.PHONY: sphinx-help clean-sphinx html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest |
773 | |
774 | -help: |
775 | +sphinx-help: |
776 | @echo "Please use \`make <target>' where <target> is one of" |
777 | @echo " html to make standalone HTML files" |
778 | @echo " dirhtml to make HTML files named index.html in directories" |
779 | @@ -26,7 +26,7 @@ |
780 | @echo " linkcheck to check all external links for integrity" |
781 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" |
782 | |
783 | -clean: |
784 | +clean-sphinx: |
785 | -rm -rf _build/* |
786 | |
787 | html: |
788 | |
789 | === modified file 'tarmac_tests.sh' |
790 | --- tarmac_tests.sh 2011-12-07 20:59:39 +0000 |
791 | +++ tarmac_tests.sh 2012-08-02 16:24:39 +0000 |
792 | @@ -2,7 +2,10 @@ |
793 | |
794 | set -e |
795 | |
796 | -virtualenv --no-site-packages virtualenv > log |
797 | -. virtualenv/bin/activate >> log |
798 | -python setup.py develop >> log |
799 | -python -m testtools.run pkgme.tests.test_suite |
800 | +LOG_FILE=log |
801 | + |
802 | +echo "Running pkgme tests in tarmac" > $LOG_FILE |
803 | +make download-cache |
804 | +bzr up download-cache |
805 | +make bootstrap >> $LOG_FILE |
806 | +make test |
807 | |
808 | === added file 'versions.cfg' |
809 | --- versions.cfg 1970-01-01 00:00:00 +0000 |
810 | +++ versions.cfg 2012-08-02 16:24:39 +0000 |
811 | @@ -0,0 +1,36 @@ |
812 | +[buildout] |
813 | +versions = versions |
814 | + |
815 | +# Update the version number here to upgrade to a new version. |
816 | +# You'll likely want to run 'make update-deps' when you have |
817 | +# changed something here. |
818 | +# |
819 | +# If you are forking a dependency then make sure you include a pointer |
820 | +# to the branch where the fork is maintained. |
821 | +# |
822 | +# Alphabetical, case-insensitive, please! :-) |
823 | +[versions] |
824 | +# Only needed for Python 2.6, in turn only needed for Jenkins. |
825 | +argparse = 1.2.1 |
826 | +Cheetah = 2.4.4 |
827 | +distribute = 0.6.28 |
828 | +fixtures = 0.3.9 |
829 | +httplib2 = 0.7.4 |
830 | +keyring = 0.9.2 |
831 | +launchpadlib = 1.10.2 |
832 | +lazr.authentication = 0.1.2 |
833 | +lazr.restfulclient = 0.13.0 |
834 | +lazr.uri = 1.0.3 |
835 | +Markdown = 2.2.0 |
836 | +oauth = 1.0.1 |
837 | +python-debian = 0.1.16 |
838 | +python-subunit = 0.0.8 |
839 | +simplejson = 2.6.1 |
840 | +testresources = 0.2.5 |
841 | +testtools = 0.9.15 |
842 | +wadllib = 1.3.1 |
843 | +wsgi-intercept = 0.5.1 |
844 | +z3c.recipe.scripts = 1.0.1 |
845 | +zc.buildout = 1.5.1 |
846 | +zc.recipe.egg = 1.3.2 |
847 | +zope.interface = 4.0.1 |
Cheating.