Merge lp:~gary/zc.buildout/python-support into lp:zc.buildout

Proposed by Gary Poster on 2010-03-19
Status: Needs review
Proposed branch: lp:~gary/zc.buildout/python-support
Merge into: lp:zc.buildout
Prerequisite: lp:~gary/zc.buildout/python-support-8-support-subprocess
Diff against target: 1026 lines (+349/-185) (has conflicts)
12 files modified
CHANGES.txt (+24/-2)
bootstrap/bootstrap.py (+1/-1)
dev.py (+44/-7)
src/zc/buildout/bootstrap.txt (+1/-1)
src/zc/buildout/buildout.py (+22/-2)
src/zc/buildout/buildout.txt (+181/-115)
src/zc/buildout/easy_install.py (+8/-28)
src/zc/buildout/easy_install.txt (+10/-5)
src/zc/buildout/tests.py (+42/-16)
src/zc/buildout/update.txt (+3/-2)
z3c.recipe.scripts_/src/z3c/recipe/scripts/tests.py (+3/-2)
zc.recipe.egg_/src/zc/recipe/egg/tests.py (+10/-4)
Text conflict in CHANGES.txt
Text conflict in src/zc/buildout/buildout.py
Text conflict in src/zc/buildout/buildout.txt
To merge this branch: bzr merge lp:~gary/zc.buildout/python-support
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) 2010-03-19 Approve on 2010-03-19
Review via email: mp+21733@code.launchpad.net

Description of the change

This merges recent zc.buildout changes with the python-support-* line of branches. As such, the only work from myself here is merge conflict resolutions.

To post a comment you must log in.
Francis J. Lacoste (flacoste) wrote :

My only question is on that change:

We have the best distribution that satisfies 'setuptools'.
> - Picked: setuptools = V.V
> + Picked: setuptools = 0.6
> <BLANKLINE>
> Configuration data:
> [buildout]
> @@ -2277,7 +2274,7 @@
> develop-eggs-directory = /sample-buildout/develop-eggs
> directory = /sample-buildout
> eggs-directory = /sample-buildout/eggs
> - executable = python
> + executable = /usr/local/bin/python2.3
> find-links =
> install-from-cache = false

Is this really correct?

review: Approve
lp:~gary/zc.buildout/python-support updated on 2010-03-19
545. By Gary Poster on 2010-03-19

reinstate test cleanup

Gary Poster (gary) wrote :

Interesting, and good catch! The change is from the trunk, but from a very old revision. One of my many early branches must have changed the "Picked" and "executable" lines to the better versions, but the bzr merge didn't quite guess correctly as to what to do. So, yes, I should change it back to the values in my branch, thank you. I've done so.

lp:~gary/zc.buildout/python-support updated on 2010-03-19
546. By Gary Poster on 2010-03-19

merge from python-support-8

Gary Poster (gary) wrote :

The most recent changes (r546) merely keep the branch up-to-date with python-support-8

lp:~gary/zc.buildout/python-support updated on 2010-04-29
547. By Gary Poster on 2010-04-19

merge gary-9

548. By Gary Poster on 2010-04-29

merge lp:~gary/zc.buildout/python-support-10: add significantly improved Distribute support.

Unmerged revisions

548. By Gary Poster on 2010-04-29

merge lp:~gary/zc.buildout/python-support-10: add significantly improved Distribute support.

547. By Gary Poster on 2010-04-19

merge gary-9

546. By Gary Poster on 2010-03-19

merge from python-support-8

545. By Gary Poster on 2010-03-19

reinstate test cleanup

544. By Gary Poster on 2010-03-19

merge from python-support-8

543. By Gary Poster on 2010-03-19

merge from buildout trunk

542. By Gary Poster on 2010-03-19

merge from gary-8

541. By Gary Poster on 2010-03-19

merge buildout trunk with system python support branches.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGES.txt'
2--- CHANGES.txt 2010-04-29 14:34:36 +0000
3+++ CHANGES.txt 2010-04-29 14:34:36 +0000
4@@ -1,11 +1,21 @@
5 Change History
6 **************
7
8+<<<<<<< TREE
9+1.4.4 (?)
10+=========
11+
12+=======
13+
14 1.?.? (201?-??-??)
15 ==================
16
17 New Features:
18
19+- Added buildout:socket-timout option so that socket timeout can be configured
20+ both from command line and from config files. (gotcha)
21+>>>>>>> MERGE-SOURCE
22+
23 - Buildout can be safely used with a system Python (or any Python with code
24 in site-packages), as long as you use the new z3c.recipe.scripts
25 recipe to generate scripts and interpreters, rather than zc.recipe.egg.
26@@ -39,22 +49,34 @@
27 * The buildout script generated by bootstrap honors more of the settings
28 in the designated configuration file (e.g., buildout.cfg).
29
30+- You can develop zc.buildout using Distribute instead of Setuptools. Use
31+ the --distribute option on the dev.py script. (Releases should be tested
32+ with both Distribute and Setuptools.)
33+
34+- The ``distribute-version`` now works in the [buildout] section, mirroring
35+ the ``setuptools-version`` option (this is for consistency; using the
36+ general-purpose ``versions`` option is preferred).
37+
38 Bugs fixed:
39
40+- Using Distribute with the ``allow-picked-versions = false`` buildout
41+ option no longer causes an error.
42+
43 - The handling and documenting of default buildout options was normalized.
44 This means, among other things, that ``bin/buildout -vv`` and
45 ``bin/buildout annotate`` correctly list more of the options.
46
47 - Installing a namespace package using a Python that already has a package
48 in the same namespace (e.g., in the Python's site-packages) failed in
49- some cases.
50+ some cases. It is now handled correctly.
51
52 - Another variation of this error showed itself when at least two
53 dependencies were in a shared location like site-packages, and the
54 first one met the "versions" setting. The first dependency would be
55 added, but subsequent dependencies from the same location (e.g.,
56 site-packages) would use the version of the package found in the
57- shared location, ignoring the version setting.
58+ shared location, ignoring the version setting. This is also now
59+ handled correctly.
60
61 1.4.3 (2009-12-10)
62 ==================
63
64=== modified file 'bootstrap/bootstrap.py'
65--- bootstrap/bootstrap.py 2010-04-29 14:34:36 +0000
66+++ bootstrap/bootstrap.py 2010-04-29 14:34:36 +0000
67@@ -115,7 +115,7 @@
68
69 options, args = parser.parse_args()
70
71-# if -c was provided, we push it back into args for buildout' main function
72+# if -c was provided, we push it back into args for buildout's main function
73 if options.config_file is not None:
74 args += ['-c', options.config_file]
75
76
77=== modified file 'dev.py'
78--- dev.py 2010-04-29 14:34:36 +0000
79+++ dev.py 2010-04-29 14:34:36 +0000
80@@ -20,6 +20,7 @@
81 """
82
83 import os, shutil, sys, subprocess, urllib2
84+from optparse import OptionParser
85
86 if sys.platform == 'win32':
87 def quote(c):
88@@ -56,10 +57,36 @@
89
90 is_jython = sys.platform.startswith('java')
91
92+setuptools_source = 'http://peak.telecommunity.com/dist/ez_setup.py'
93+distribute_source = 'http://python-distribute.org/distribute_setup.py'
94+
95+usage = '''\
96+[DESIRED PYTHON FOR DEVELOPING BUILDOUT] dev.py [options]
97+
98+Bootstraps buildout itself for development.
99+
100+This is different from a normal bootstrapping process because the
101+buildout egg itself is installed as a develop egg.
102+'''
103+
104+parser = OptionParser(usage=usage)
105+parser.add_option("-d", "--distribute",
106+ action="store_true", dest="use_distribute", default=False,
107+ help="Use Distribute rather than Setuptools.")
108+
109+options, args = parser.parse_args()
110+
111+if args:
112+ parser.error('This script accepts no arguments other than its options.')
113+
114+if options.use_distribute:
115+ setup_source = distribute_source
116+else:
117+ setup_source = setuptools_source
118+
119 for d in 'eggs', 'develop-eggs', 'bin':
120 if not os.path.exists(d):
121 os.mkdir(d)
122-
123 if os.path.isdir('build'):
124 shutil.rmtree('build')
125
126@@ -67,22 +94,32 @@
127 to_reload = False
128 import pkg_resources
129 to_reload = True
130+ if not hasattr(pkg_resources, '_distribute'):
131+ raise ImportError
132 import setuptools # A flag. Sometimes pkg_resources is installed alone.
133 except ImportError:
134+ ez_code = urllib2.urlopen(setup_source).read().replace('\r\n', '\n')
135 ez = {}
136- exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
137- ).read() in ez
138- ez['use_setuptools'](to_dir='eggs', download_delay=0)
139-
140- import pkg_resources
141+ exec ez_code in ez
142+ setup_args = dict(to_dir='eggs', download_delay=0)
143+ if options.use_distribute:
144+ setup_args['no_fake'] = True
145+ ez['use_setuptools'](**setup_args)
146 if to_reload:
147 reload(pkg_resources)
148+ else:
149+ import pkg_resources
150+ # This does not (always?) update the default working set. We will
151+ # do it.
152+ for path in sys.path:
153+ if path not in pkg_resources.working_set.entries:
154+ pkg_resources.working_set.add_entry(path)
155
156 env = os.environ.copy() # Windows needs yet-to-be-determined values from this.
157 env['PYTHONPATH'] = os.path.dirname(pkg_resources.__file__)
158 subprocess.Popen(
159 [sys.executable] +
160- ['-S', 'setup.py', '-q', 'develop', '-m', '-x', '-d', 'develop-eggs'],
161+ ['setup.py', '-q', 'develop', '-m', '-x', '-d', 'develop-eggs'],
162 env=env).wait()
163
164 pkg_resources.working_set.add_entry('src')
165
166=== modified file 'src/zc/buildout/bootstrap.txt'
167--- src/zc/buildout/bootstrap.txt 2010-04-29 14:34:36 +0000
168+++ src/zc/buildout/bootstrap.txt 2010-04-29 14:34:36 +0000
169@@ -47,7 +47,7 @@
170 X...
171 d zc.buildout-...egg
172
173-Now trying the `--version` option, that let you define a version for
174+Now we will try the `--version` option, which lets you define a version for
175 `zc.buildout`. If not provided, bootstrap will look for the latest one.
176
177 Let's try with an unknown version::
178
179=== modified file 'src/zc/buildout/buildout.py'
180--- src/zc/buildout/buildout.py 2010-04-29 14:34:36 +0000
181+++ src/zc/buildout/buildout.py 2010-04-29 14:34:36 +0000
182@@ -128,8 +128,16 @@
183 'parts-directory': 'parts',
184 'prefer-final': 'false',
185 'python': 'buildout',
186+<<<<<<< TREE
187+ 'executable': sys.executable,
188+ 'log-level': 'INFO',
189+ 'log-format': '',
190+=======
191+ 'relative-paths': 'false',
192+ 'socket-timeout': '',
193 'unzip': 'false',
194 'use-dependency-links': 'true',
195+>>>>>>> MERGE-SOURCE
196 }, 'DEFAULT_VALUE')
197
198
199@@ -397,9 +405,16 @@
200 partsdir = os.path.join(options['parts-directory'], 'buildout')
201 if not os.path.exists(partsdir):
202 os.mkdir(partsdir)
203+ # (Honor the relative-paths option.)
204+ relative_paths = options.get('relative-paths', 'false')
205+ if relative_paths == 'true':
206+ relative_paths = options['directory']
207+ else:
208+ assert relative_paths == 'false'
209+ relative_paths = ''
210 zc.buildout.easy_install.sitepackage_safe_scripts(
211 options['bin-directory'], ws, options['executable'], partsdir,
212- reqs=['zc.buildout'])
213+ reqs=['zc.buildout'], relative_paths=relative_paths)
214
215 init = bootstrap
216
217@@ -830,10 +845,15 @@
218
219 options = self['buildout']
220
221+ specs = ['zc.buildout']
222+ if zc.buildout.easy_install.is_distribute:
223+ specs.append('distribute')
224+ else:
225+ specs.append('setuptools')
226 ws = zc.buildout.easy_install.install(
227 [
228 (spec + ' ' + options.get(spec+'-version', '')).strip()
229- for spec in ('zc.buildout', 'setuptools')
230+ for spec in specs
231 ],
232 options['eggs-directory'],
233 links = options.get('find-links', '').split(),
234
235=== modified file 'src/zc/buildout/buildout.txt'
236--- src/zc/buildout/buildout.txt 2010-04-29 14:34:36 +0000
237+++ src/zc/buildout/buildout.txt 2010-04-29 14:34:36 +0000
238@@ -767,10 +767,17 @@
239 DEFAULT_VALUE
240 python= buildout
241 DEFAULT_VALUE
242+<<<<<<< TREE
243+=======
244+ relative-paths= false
245+ DEFAULT_VALUE
246+ socket-timeout=
247+ DEFAULT_VALUE
248 unzip= false
249 DEFAULT_VALUE
250 use-dependency-links= true
251 DEFAULT_VALUE
252+>>>>>>> MERGE-SOURCE
253 <BLANKLINE>
254 [data-dir]
255 path= foo bins
256@@ -2241,8 +2248,13 @@
257 parts-directory = /sample-buildout/parts
258 prefer-final = false
259 python = buildout
260+<<<<<<< TREE
261+=======
262+ relative-paths = false
263+ socket-timeout =
264 unzip = false
265 use-dependency-links = true
266+>>>>>>> MERGE-SOURCE
267 verbosity = 20
268 <BLANKLINE>
269
270@@ -2250,37 +2262,6 @@
271 command-line assignments. We've discussed most of these options
272 already, but let's review them and touch on some we haven't discussed:
273
274-allow-hosts
275- On some environments the links visited by `zc.buildout` can be forbidden by
276- paranoid firewalls. These URLs might be in the chain of links visited by
277- `zc.buildout` as defined by buildout's `find-links` option, or as defined
278- by various eggs in their `url`, `download_url`, `dependency_links` metadata.
279-
280- The fact that package_index works like a spider and might visit links and
281- go to other locations makes this even harder.
282-
283- The `allow-hosts` option provides a way to prevent this, and
284- works exactly like the one provided in `easy_install`.
285-
286- You can provide a list of allowed host, together with wildcards::
287-
288- [buildout]
289- ...
290-
291- allow-hosts =
292- *.python.org
293- example.com
294-
295- All URLs that does not match these hosts will not be visited.
296-
297-allow-picked-versions
298- By default, the buildout will choose the best match for a given requirement
299- if the requirement is not specified precisely (for instance, using the
300- "versions" option. This behavior corresponds to the
301- "allow-picked-versions" being set to its default value, "true". If
302- "allow-picked-versions" is "false," instead of picking the best match,
303- buildout will raise an error. This helps enforce repeatability.
304-
305 bin-directory
306 The directory path where scripts are written. This can be a
307 relative path, which is interpreted relative to the directory
308@@ -2305,47 +2286,6 @@
309 The Python executable used to run the buildout. See the python
310 option below.
311
312-find-links
313- You can specify more locations to search for distributions using the
314- `find-links` option. All locations specified will be searched for
315- distributions along with the package index as described before.
316-
317- Locations can be urls::
318-
319- [buildout]
320- ...
321- find-links = http://download.zope.org/distribution/
322-
323- They can also be directories on disk::
324-
325- [buildout]
326- ...
327- find-links = /some/path
328-
329- Finally, they can also be direct paths to distributions::
330-
331- [buildout]
332- ...
333- find-links = /some/path/someegg-1.0.0-py2.3.egg
334-
335- Any number of locations can be specified in the `find-links` option::
336-
337- [buildout]
338- ...
339- find-links =
340- http://download.zope.org/distribution/
341- /some/otherpath
342- /some/path/someegg-1.0.0-py2.3.egg
343-
344-install-from-cache
345- A download cache can be used as the basis of application source releases.
346- In an application source release, we want to distribute an application that
347- can be built without making any network accesses. In this case, we
348- distribute a buildout with download cache and tell the buildout to install
349- from the download cache only, without making network accesses. The
350- buildout install-from-cache option can be used to signal that packages
351- should be installed only from the download cache.
352-
353 installed
354 The file path where information about the results of the previous
355 buildout run is written. This can be a relative path, which is
356@@ -2359,51 +2299,12 @@
357 log-level
358 The log level before verbosity adjustment
359
360-newest
361- By default buildout and recipes will try to find the newest versions of
362- distributions needed to satisfy requirements. This can be very time
363- consuming, especially when incrementally working on setting up a buildout
364- or working on a recipe. The buildout "newest" option can be used to to
365- suppress this. If the "newest" option is set to false, then new
366- distributions won't be sought if an installed distribution meets
367- requirements. The "newest" option can also be set to false using the -N
368- command-line option. See also the "offline" option.
369-
370-offline
371- The "offline" option goes a bit further than the "newest" option. If the
372- buildout "offline" option is given a value of "true", the buildout and
373- recipes that are aware of the option will avoid doing network access. This
374- is handy when running the buildout when not connected to the internet. It
375- also makes buildouts run much faster. This option is typically set using
376- the buildout -o option.
377-
378 parts
379 A white space separated list of parts to be installed.
380
381 parts-directory
382 A working directory that parts can used to store data.
383
384-prefer-final
385- Currently, when searching for new releases, the newest available
386- release is used. This isn't usually ideal, as you may get a
387- development release or alpha releases not ready to be widely used.
388- You can request that final releases be preferred using the prefer
389- final option in the buildout section::
390-
391- [buildout]
392- ...
393- prefer-final = true
394-
395- When the prefer-final option is set to true, then when searching for
396- new releases, final releases are preferred. If there are final
397- releases that satisfy distribution requirements, then those releases
398- are used even if newer non-final releases are available. The buildout
399- prefer-final option can be used to override this behavior.
400-
401- In buildout version 2, final releases will be preferred by default.
402- You will then need to use a false value for prefer-final to get the
403- newest releases.
404-
405 python
406 The name of a section containing information about the default
407 Python interpreter. Recipes that need a installation
408@@ -2414,6 +2315,13 @@
409 Python executable. By default, the buildout section defines the
410 default Python as the Python used to run the buildout.
411
412+relative-paths
413+ The paths generated by zc.buildout are absolute by default, and this
414+ option is ``false``. However, if you set this value to be ``true``,
415+ bin/buildout will be generated with code that makes the paths relative.
416+ Some recipes, such as zc.recipe.egg and z3c.recipe.scripts, honor this
417+ value as well.
418+
419 unzip
420 By default, zc.buildout doesn't unzip zip-safe eggs ("unzip = false").
421 This follows the policy followed by setuptools itself. Experience shows
422@@ -2480,8 +2388,56 @@
423 directory if the original buildout had develop eggs for either
424 buildout or setuptools.)
425
426-Note that the buildout script was installed but not run. To run
427-the buildout, we'd have to run the installed buildout script.
428+If relative-paths is ``true``, the buildout script uses relative paths.
429+
430+ >>> write(sample_bootstrapped, 'setup.cfg',
431+ ... '''
432+ ... [buildout]
433+ ... relative-paths = true
434+ ... parts =
435+ ... ''')
436+
437+ >>> print system(buildout
438+ ... +' -c'+os.path.join(sample_bootstrapped, 'setup.cfg')
439+ ... +' bootstrap'),
440+ Generated script '/sample-bootstrapped/bin/buildout'.
441+
442+ >>> buildout_script = join(sample_bootstrapped, 'bin', 'buildout')
443+ >>> import sys
444+ >>> if sys.platform.startswith('win'):
445+ ... buildout_script += '-script.py'
446+ >>> print open(buildout_script).read() # doctest: +ELLIPSIS
447+ #!... -S
448+ <BLANKLINE>
449+ import os
450+ <BLANKLINE>
451+ join = os.path.join
452+ base = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
453+ base = os.path.dirname(base)
454+ <BLANKLINE>
455+ import sys
456+ sys.path[0:0] = [
457+ join(base, 'parts/buildout'),
458+ ]
459+ <BLANKLINE>
460+ <BLANKLINE>
461+ import os
462+ path = sys.path[0]
463+ if os.environ.get('PYTHONPATH'):
464+ path = os.pathsep.join([path, os.environ['PYTHONPATH']])
465+ os.environ['PYTHONPATH'] = path
466+ import site # imports custom buildout-generated site.py
467+ <BLANKLINE>
468+ import zc.buildout.buildout
469+ <BLANKLINE>
470+ if __name__ == '__main__':
471+ zc.buildout.buildout.main()
472+ <BLANKLINE>
473+
474+
475+Note that, in the above two examples, the buildout script was installed
476+but not run. To run the buildout, we'd have to run the installed
477+buildout script.
478
479 If we have an existing buildout that already has a buildout.cfg, we'll
480 normally use the bootstrap command instead of init. It will complain
481@@ -2512,6 +2468,48 @@
482 Generated script '/sample-bootstrapped2/bin/buildout'.
483
484
485+Newest and Offline Modes
486+------------------------
487+
488+By default buildout and recipes will try to find the newest versions
489+of distributions needed to satisfy requirements. This can be very
490+time consuming, especially when incrementally working on setting up a
491+buildout or working on a recipe. The buildout newest option can be
492+used to to suppress this. If the newest option is set to false, then
493+new distributions won't be sought if an installed distribution meets
494+requirements. The newest option can be set to false using the -N
495+command-line option.
496+
497+The offline option goes a bit further. If the buildout offline option
498+is given a value of "true", the buildout and recipes that are aware of
499+the option will avoid doing network access. This is handy when
500+running the buildout when not connected to the internet. It also
501+makes buildouts run much faster. This option is typically set using
502+the buildout -o option.
503+
504+Preferring Final Releases
505+-------------------------
506+
507+Currently, when searching for new releases, the newest available
508+release is used. This isn't usually ideal, as you may get a
509+development release or alpha releases not ready to be widely used.
510+You can request that final releases be preferred using the prefer
511+final option in the buildout section::
512+
513+ [buildout]
514+ ...
515+ prefer-final = true
516+
517+When the prefer-final option is set to true, then when searching for
518+new releases, final releases are preferred. If there are final
519+releases that satisfy distribution requirements, then those releases
520+are used even if newer non-final releases are available. The buildout
521+prefer-final option can be used to override this behavior.
522+
523+In buildout version 2, final releases will be preferred by default.
524+You will then need to use a false value for prefer-final to get the
525+newest releases.
526+
527 Finding distributions
528 ---------------------
529
530@@ -2530,7 +2528,49 @@
531 requirements of the buildout will always be used.
532
533 You can also specify more locations to search for distributions using
534-the `find-links` option. See its description above.
535+the `find-links` option. All locations specified will be searched for
536+distributions along with the package index as described before.
537+
538+Locations can be urls::
539+
540+ [buildout]
541+ ...
542+ find-links = http://download.zope.org/distribution/
543+
544+They can also be directories on disk::
545+
546+ [buildout]
547+ ...
548+ find-links = /some/path
549+
550+Finally, they can also be direct paths to distributions::
551+
552+ [buildout]
553+ ...
554+ find-links = /some/path/someegg-1.0.0-py2.3.egg
555+
556+Any number of locations can be specified in the `find-links` option::
557+
558+ [buildout]
559+ ...
560+ find-links =
561+ http://download.zope.org/distribution/
562+ /some/otherpath
563+ /some/path/someegg-1.0.0-py2.3.egg
564+
565+Dependency links
566+----------------
567+
568+By default buildout will obey the setuptools dependency_links metadata
569+when it looks for dependencies. This behavior can be controlled with
570+the use-dependency-links buildout option::
571+
572+ [buildout]
573+ ...
574+ use-dependency-links = false
575+
576+The option defaults to true. If you set it to false, then dependency
577+links are only looked for in the locations specified by find-links.
578
579 Controlling the installation database
580 -------------------------------------
581@@ -2692,11 +2732,37 @@
582 Develop: '/sample-bootstrapped/demo'
583 unload ['buildout']
584
585+Allow hosts
586+-----------
587+
588+On some environments the links visited by `zc.buildout` can be forbidden
589+by paranoiac firewalls. These URL might be on the chain of links
590+visited by `zc.buildout` wheter they are defined in the `find-links` option,
591+wheter they are defined by various eggs in their `url`, `download_url`,
592+`dependency_links` metadata.
593+
594+It is even harder to track that package_index works like a spider and
595+might visit links and go to other location.
596+
597+The `allow-hosts` option provides a way to prevent this, and
598+works exactly like the one provided in `easy_install`.
599+
600+You can provide a list of allowed host, together with wildcards::
601+
602+ [buildout]
603+ ...
604+
605+ allow-hosts =
606+ *.python.org
607+ example.com
608+
609+All urls that does not match these hosts will not be visited.
610+
611 .. [#future_recipe_methods] In the future, additional methods may be
612 added. Older recipes with fewer methods will still be
613 supported.
614
615 .. [#packaging_info] If we wanted to create a distribution from this
616- package, we would need to specify much more information. See the
617+ package, we would need specify much more information. See the
618 `setuptools documentation
619 <http://peak.telecommunity.com/DevCenter/setuptools>`_.
620
621=== modified file 'src/zc/buildout/easy_install.py'
622--- src/zc/buildout/easy_install.py 2010-04-29 14:34:36 +0000
623+++ src/zc/buildout/easy_install.py 2010-04-29 14:34:36 +0000
624@@ -51,6 +51,8 @@
625
626 is_win32 = sys.platform == 'win32'
627 is_jython = sys.platform.startswith('java')
628+is_distribute = (
629+ pkg_resources.Requirement.parse('setuptools').key=='distribute')
630
631 if is_jython:
632 import java.lang.System
633@@ -802,6 +804,8 @@
634
635
636 def _constrain(self, requirement):
637+ if is_distribute and requirement.key == 'setuptools':
638+ requirement = pkg_resources.Requirement.parse('distribute')
639 version = self._versions.get(requirement.project_name)
640 if version:
641 if version not in requirement:
642@@ -853,30 +857,6 @@
643 # Note that we don't use the existing environment, because we want
644 # to look for new eggs unless what we have is the best that
645 # matches the requirement.
646-<<<<<<< TREE
647- while 1:
648- try:
649- ws.resolve(requirements)
650- except pkg_resources.DistributionNotFound, err:
651- [requirement] = err
652- requirement = self._constrain(requirement)
653- if destination:
654- logger.debug('Getting required %r', str(requirement))
655- else:
656- logger.debug('Adding required %r', str(requirement))
657- _log_requirement(ws, requirement)
658-
659- for dist in self._get_dist(requirement, ws, self._always_unzip
660- ):
661-
662- ws.add(dist)
663- self._maybe_add_setuptools(ws, dist)
664- except pkg_resources.VersionConflict, err:
665- raise VersionConflict(err, ws)
666- else:
667- break
668-
669-=======
670 env = pkg_resources.Environment(ws.entries)
671 while requirements:
672 # Process dependencies breadth-first.
673@@ -911,7 +891,6 @@
674 processed[req] = True
675 if dist.location in self._site_packages:
676 logger.debug('Egg from site-packages: %s', dist)
677->>>>>>> MERGE-SOURCE
678 return ws
679
680 def build(self, spec, build_ext):
681@@ -1224,12 +1203,12 @@
682 return generated
683
684 _script_initialization_template = '''
685-import site # imports custom buildout-generated site.py
686 import os
687-path = %(site_py_dest)r
688+path = sys.path[0]
689 if os.environ.get('PYTHONPATH'):
690 path = os.pathsep.join([path, os.environ['PYTHONPATH']])
691 os.environ['PYTHONPATH'] = path
692+import site # imports custom buildout-generated site.py
693 %(script_initialization)s'''
694
695 # Utilities for the script generation functions.
696@@ -1509,7 +1488,7 @@
697 - executable is a path to the desired Python executable.
698 - name is the name of the (pure, not C) Python module.
699 """
700- cmd = [executable, "-c",
701+ cmd = [executable, "-Sc",
702 "import imp; "
703 "fp, path, desc = imp.find_module(%r); "
704 "fp.close; "
705@@ -1632,6 +1611,7 @@
706 pkg_resources.working_set.add_entry(sitedir)'''
707
708 original_path_snippet = '''
709+ sys.__egginsert = len(buildout_paths) # Support distribute.
710 original_paths = [
711 %s
712 ]
713
714=== modified file 'src/zc/buildout/easy_install.txt'
715--- src/zc/buildout/easy_install.txt 2010-04-29 14:34:36 +0000
716+++ src/zc/buildout/easy_install.txt 2010-04-29 14:34:36 +0000
717@@ -222,7 +222,9 @@
718 d other-1.0-py2.4.egg
719
720 We can request that eggs be unzipped even if they are zip safe. This
721-can be useful when debugging.
722+can be useful when debugging. (Note that Distribute will unzip eggs by
723+default, so if you are using Distribute, most or all eggs will already be
724+unzipped without this flag.)
725
726 >>> rmdir(dest)
727 >>> dest = tmpdir('sample-install')
728@@ -1284,6 +1286,7 @@
729 if not sitedircase in known_paths and os.path.exists(sitedir):
730 sys.path.append(sitedir)
731 known_paths.add(sitedircase)
732+ sys.__egginsert = len(buildout_paths) # Support distribute.
733 original_paths = [
734 ...
735 ]
736@@ -1360,6 +1363,7 @@
737 sys.path.append(sitedir)
738 known_paths.add(sitedircase)
739 pkg_resources.working_set.add_entry(sitedir)
740+ sys.__egginsert = len(buildout_paths) # Support distribute.
741 original_paths = [
742 ...
743 ]
744@@ -1423,6 +1427,7 @@
745 sys.path.append(sitedir)
746 known_paths.add(sitedircase)
747 pkg_resources.working_set.add_entry(sitedir)
748+ sys.__egginsert = len(buildout_paths) # Support distribute.
749 original_paths = [
750 ...
751 ]
752@@ -1498,12 +1503,12 @@
753 ]
754 <BLANKLINE>
755 <BLANKLINE>
756- import site # imports custom buildout-generated site.py
757 import os
758- path = '/interpreter/parts/interpreter'
759+ path = sys.path[0]
760 if os.environ.get('PYTHONPATH'):
761 path = os.pathsep.join([path, os.environ['PYTHONPATH']])
762 os.environ['PYTHONPATH'] = path
763+ import site # imports custom buildout-generated site.py
764 <BLANKLINE>
765 import eggrecipedemo
766 <BLANKLINE>
767@@ -1542,12 +1547,12 @@
768 '/interpreter/parts/interpreter',
769 ]
770 <BLANKLINE>
771- import site # imports custom buildout-generated site.py
772 import os
773- path = '/interpreter/parts/interpreter'
774+ path = sys.path[0]
775 if os.environ.get('PYTHONPATH'):
776 path = os.pathsep.join([path, os.environ['PYTHONPATH']])
777 os.environ['PYTHONPATH'] = path
778+ import site # imports custom buildout-generated site.py
779 import os
780 os.chdir("foo")
781 <BLANKLINE>
782
783=== modified file 'src/zc/buildout/tests.py'
784--- src/zc/buildout/tests.py 2010-04-29 14:34:36 +0000
785+++ src/zc/buildout/tests.py 2010-04-29 14:34:36 +0000
786@@ -864,7 +864,8 @@
787 - z3c.recipe.scripts.egg-link
788 - zc.recipe.egg.egg-link
789
790- >>> ls('eggs') # doctest: +ELLIPSIS
791+ >>> print 'START ->'; ls('eggs') # doctest: +ELLIPSIS
792+ START...
793 - foox-0.0.0-py2.4.egg
794 ...
795
796@@ -3103,6 +3104,13 @@
797 >>> write('foo.py', '')
798 >>> _ = system(buildout+' setup . sdist')
799
800+ >>> if zc.buildout.easy_install.is_distribute:
801+ ... distribute_version = 'distribute = %s' % (
802+ ... pkg_resources.working_set.find(
803+ ... pkg_resources.Requirement.parse('distribute')).version,)
804+ ... else:
805+ ... distribute_version = ''
806+ ...
807 >>> write('buildout.cfg',
808 ... '''
809 ... [buildout]
810@@ -3114,12 +3122,14 @@
811 ... [versions]
812 ... setuptools = %s
813 ... foo = 1
814+ ... %s
815 ...
816 ... [foo]
817 ... recipe = zc.recipe.egg
818 ... eggs = foo
819- ... ''' % pkg_resources.working_set.find(
820- ... pkg_resources.Requirement.parse('setuptools')).version)
821+ ... ''' % (pkg_resources.working_set.find(
822+ ... pkg_resources.Requirement.parse('setuptools')).version,
823+ ... distribute_version))
824
825 >>> print system(buildout),
826 Installing foo.
827@@ -3623,11 +3633,13 @@
828
829 # now let's make the new releases
830 makeNewRelease('zc.buildout', ws, new_releases)
831- makeNewRelease('setuptools', ws, new_releases)
832-
833 os.mkdir(os.path.join(new_releases, 'zc.buildout'))
834- os.mkdir(os.path.join(new_releases, 'setuptools'))
835-
836+ if zc.buildout.easy_install.is_distribute:
837+ makeNewRelease('distribute', ws, new_releases)
838+ os.mkdir(os.path.join(new_releases, 'distribute'))
839+ else:
840+ makeNewRelease('setuptools', ws, new_releases)
841+ os.mkdir(os.path.join(new_releases, 'setuptools'))
842
843
844 normalize_bang = (
845@@ -3651,7 +3663,8 @@
846 '__buildout_signature__ = recipes-SSSSSSSSSSS'),
847 (re.compile('executable = [\S ]+python\S*', re.I),
848 'executable = python'),
849- (re.compile('[-d] setuptools-\S+[.]egg'), 'setuptools.egg'),
850+ (re.compile('[-d] (setuptools|distribute)-\S+[.]egg'),
851+ 'setuptools.egg'),
852 (re.compile('zc.buildout(-\S+)?[.]egg(-link)?'),
853 'zc.buildout.egg'),
854 (re.compile('creating \S*setup.cfg'), 'creating setup.cfg'),
855@@ -3666,6 +3679,7 @@
856 r'when that file already exists: '),
857 '[Errno 17] File exists: '
858 ),
859+ (re.compile('distribute'), 'setuptools'),
860 ])
861 ),
862 doctest.DocFileSuite(
863@@ -3695,9 +3709,18 @@
864 (re.compile('(zc.buildout|setuptools)-\d+[.]\d+\S*'
865 '-py\d.\d.egg'),
866 '\\1.egg'),
867+ (re.compile('distribute-\d+[.]\d+\S*'
868+ '-py\d.\d.egg'),
869+ 'setuptools.egg'),
870 (re.compile('(zc.buildout|setuptools)( version)? \d+[.]\d+\S*'),
871 '\\1 V.V'),
872- (re.compile('[-d] setuptools'), '- setuptools'),
873+ (re.compile('distribute( version)? \d+[.]\d+\S*'),
874+ 'setuptools V.V'),
875+ (re.compile('[-d] (setuptools|distribute)'), '- setuptools'),
876+ (re.compile('distribute'), 'setuptools'),
877+ (re.compile("\nUnused options for buildout: "
878+ "'(distribute|setuptools)\-version'\."),
879+ '')
880 ])
881 ),
882
883@@ -3713,17 +3736,17 @@
884 zc.buildout.testing.normalize_egg_py,
885 normalize_bang,
886 (re.compile('extdemo[.]pyd'), 'extdemo.so'),
887- (re.compile('[-d] setuptools-\S+[.]egg'), 'setuptools.egg'),
888+ (re.compile('[-d] (setuptools|distribute)-\S+[.]egg'),
889+ 'setuptools.egg'),
890 (re.compile(r'\\[\\]?'), '/'),
891-<<<<<<< TREE
892- (re.compile(r'\#!\S+\bpython\S*'), '#!/usr/bin/python'),
893-=======
894 (re.compile(r'\#!\S+\bpython\S*'), '#!/usr/bin/python'),
895 # Normalize generate_script's Windows interpreter to UNIX:
896 (re.compile(r'\nimport subprocess\n'), '\n'),
897 (re.compile('subprocess\\.call\\(argv, env=environ\\)'),
898 'os.execve(sys.executable, argv, environ)'),
899->>>>>>> MERGE-SOURCE
900+ (re.compile('distribute'), 'setuptools'),
901+ # Distribute unzips eggs by default.
902+ (re.compile('\- demoneeded'), 'd demoneeded'),
903 ]+(sys.version_info < (2, 5) and [
904 (re.compile('.*No module named runpy.*', re.S), ''),
905 (re.compile('.*usage: pdb.py scriptfile .*', re.S), ''),
906@@ -3755,7 +3778,7 @@
907 zc.buildout.testing.normalize_egg_py,
908 (re.compile("buildout: Running \S*setup.py"),
909 'buildout: Running setup.py'),
910- (re.compile('setuptools-\S+-'),
911+ (re.compile('(setuptools|distribute)-\S+-'),
912 'setuptools.egg'),
913 (re.compile('zc.buildout-\S+-'),
914 'zc.buildout.egg'),
915@@ -3763,7 +3786,7 @@
916 'File "one.py"'),
917 (re.compile(r'We have a develop egg: (\S+) (\S+)'),
918 r'We have a develop egg: \1 V'),
919- (re.compile('Picked: setuptools = \S+'),
920+ (re.compile('Picked: (setuptools|distribute) = \S+'),
921 'Picked: setuptools = V'),
922 (re.compile(r'\\[\\]?'), '/'),
923 (re.compile(
924@@ -3774,6 +3797,9 @@
925 # for bug_92891_bootstrap_crashes_with_egg_recipe_in_buildout_section
926 (re.compile(r"Unused options for buildout: 'eggs' 'scripts'\."),
927 "Unused options for buildout: 'scripts' 'eggs'."),
928+ (re.compile('distribute'), 'setuptools'),
929+ # Distribute unzips eggs by default.
930+ (re.compile('\- demoneeded'), 'd demoneeded'),
931 ]),
932 ),
933 zc.buildout.testselectingpython.test_suite(),
934
935=== modified file 'src/zc/buildout/update.txt'
936--- src/zc/buildout/update.txt 2010-04-29 14:34:36 +0000
937+++ src/zc/buildout/update.txt 2010-04-29 14:34:36 +0000
938@@ -100,8 +100,8 @@
939 ...
940
941 Now, let's recreate the sample buildout. If we specify constraints on
942-the versions of zc.buildout and setuptools to use, running the
943-buildout will install earlier versions of these packages:
944+the versions of zc.buildout and setuptools (or distribute) to use,
945+running the buildout will install earlier versions of these packages:
946
947 >>> write(sample_buildout, 'buildout.cfg',
948 ... """
949@@ -112,6 +112,7 @@
950 ... develop = showversions
951 ... zc.buildout-version = < 99
952 ... setuptools-version = < 99
953+ ... distribute-version = < 99
954 ...
955 ... [show-versions]
956 ... recipe = showversions
957
958=== modified file 'z3c.recipe.scripts_/src/z3c/recipe/scripts/tests.py'
959--- z3c.recipe.scripts_/src/z3c/recipe/scripts/tests.py 2010-04-29 14:34:36 +0000
960+++ z3c.recipe.scripts_/src/z3c/recipe/scripts/tests.py 2010-04-29 14:34:36 +0000
961@@ -423,8 +423,8 @@
962 zc.buildout.tests.normalize_bang,
963 (re.compile(r'zc.buildout(-\S+)?[.]egg(-link)?'),
964 'zc.buildout.egg'),
965- (re.compile('[-d] setuptools-[^-]+-'), 'setuptools-X-'),
966- (re.compile(r'setuptools-[\w.]+-py'), 'setuptools-X-py'),
967+ (re.compile('[-d] (setuptools|distribute)-[^-]+-'), 'setuptools-X-'),
968+ (re.compile(r'(setuptools|distribute)-[\w.]+-py'), 'setuptools-X-py'),
969 (re.compile(r'eggs\\\\demo'), 'eggs/demo'),
970 (re.compile(r'[a-zA-Z]:\\\\foo\\\\bar'), '/foo/bar'),
971 (re.compile(r'\#!\S+\bpython\S*'), '#!/usr/bin/python'),
972@@ -432,6 +432,7 @@
973 (re.compile(r'\nimport subprocess\n'), '\n'),
974 (re.compile('subprocess\\.call\\(argv, env=environ\\)'),
975 'os.execve(sys.executable, argv, environ)'),
976+ (re.compile('distribute'), 'setuptools'),
977 ])
978 ),
979 doctest.DocTestSuite(
980
981=== modified file 'zc.recipe.egg_/src/zc/recipe/egg/tests.py'
982--- zc.recipe.egg_/src/zc/recipe/egg/tests.py 2010-04-29 14:34:36 +0000
983+++ zc.recipe.egg_/src/zc/recipe/egg/tests.py 2010-04-29 14:34:36 +0000
984@@ -50,9 +50,12 @@
985 zc.buildout.tests.normalize_bang,
986 (re.compile('zc.buildout(-\S+)?[.]egg(-link)?'),
987 'zc.buildout.egg'),
988- (re.compile('[-d] setuptools-[^-]+-'), 'setuptools-X-'),
989+ (re.compile('[-d] (setuptools|distribute)-[^-]+-'),
990+ 'setuptools-X-'),
991 (re.compile(r'eggs\\\\demo'), 'eggs/demo'),
992 (re.compile(r'[a-zA-Z]:\\\\foo\\\\bar'), '/foo/bar'),
993+ # Distribute unzips eggs by default.
994+ (re.compile('\- demoneeded'), 'd demoneeded'),
995 ])
996 ),
997 doctest.DocFileSuite(
998@@ -64,7 +67,7 @@
999 (re.compile('__buildout_signature__ = '
1000 'sample-\S+\s+'
1001 'zc.recipe.egg-\S+\s+'
1002- 'setuptools-\S+\s+'
1003+ '(setuptools|distribute)-\S+\s+'
1004 'zc.buildout-\S+\s*'
1005 ),
1006 '__buildout_signature__ = sample- zc.recipe.egg-\n'),
1007@@ -104,14 +107,17 @@
1008 zc.buildout.testing.normalize_path,
1009 zc.buildout.testing.normalize_endings,
1010 zc.buildout.testing.normalize_script,
1011- (re.compile('Got setuptools \S+'), 'Got setuptools V'),
1012- (re.compile('([d-] )?setuptools-\S+-py'),
1013+ (re.compile('Got (setuptools|distribute) \S+'),
1014+ 'Got setuptools V'),
1015+ (re.compile('([d-] )?(setuptools|distribute)-\S+-py'),
1016 'setuptools-V-py'),
1017 (re.compile('-py2[.][0-35-9][.]'), 'py2.5.'),
1018 (re.compile('zc.buildout-\S+[.]egg'),
1019 'zc.buildout.egg'),
1020 (re.compile('zc.buildout[.]egg-link'),
1021 'zc.buildout.egg'),
1022+ # Distribute unzips eggs by default.
1023+ (re.compile('\- demoneeded'), 'd demoneeded'),
1024 ]),
1025 ),
1026 )

Subscribers

People subscribed via source and target branches

to all changes: