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

Proposed by Gary Poster
Status: Needs review
Proposed branch: lp:~gary/zc.buildout/python-support-3-options
Merge into: lp:zc.buildout
Prerequisite: lp:~gary/zc.buildout/python-support-2-bootstrap
Diff against target: 672 lines (+233/-169)
5 files modified
CHANGES.txt (+6/-0)
src/zc/buildout/buildout.py (+51/-42)
src/zc/buildout/buildout.txt (+162/-116)
src/zc/buildout/tests.py (+3/-0)
zc.recipe.egg_/src/zc/recipe/egg/egg.py (+11/-11)
To merge this branch: bzr merge lp:~gary/zc.buildout/python-support-3-options
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) Approve
Review via email: mp+19539@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Gary Poster (gary) wrote :

This branch cleans up the way default options are handled in buildout so that it is all done in the same way. As a nice side-effect, this means that ``./bin/buildout annotate`` and similar tools give a more thorough description of the values being used.

542. By Gary Poster

propagate merge from gary-2 <- gary-1 <- trunk

Revision history for this message
Francis J. Lacoste (flacoste) wrote :

Hi Gary,

Everything looks fine, the only snippet I don't understand is that one

> === modified file 'src/zc/buildout/tests.py'
> --- src/zc/buildout/tests.py 2010-02-17 21:27:15 +0000
> +++ src/zc/buildout/tests.py 2010-02-17 21:27:15 +0000
> @@ -2981,6 +2981,9 @@
> '-q develop -mxN -d /sample-buildout/develop-eggs'
> ),
> (re.compile(r'^[*]...'), '...'),
> + # for bug_92891_bootstrap_crashes_with_egg_recipe_in_buildout_section
> + (re.compile(r"Unused options for buildout: 'eggs' 'scripts'\."),
> + "Unused options for buildout: 'scripts' 'eggs'."),
> ]),
> ),
> zc.buildout.testselectingpython.test_suite(),
>

I assume it's good, but I'd like to have an explanation for it, since you
didn't mention it in your presentation.

Cheers

review: Approve
Revision history for this message
Gary Poster (gary) wrote :

Thank you, Francis.

Yes, arguably this should have gone in the first branch, since it is a test cleanup, though it is a test cleanup of the option code so I put it over here. It doesn't have anything specifically to do with the basic point of the branch, so it was a good catch to bring up.

The order that the unused options were presented ("'eggs' 'scripts'" or "'scripts' 'eggs'") varied across Python versions. I could have changed the generation to order alphabetically (or similarly), but instead I normalized in the test results.

Gary

Unmerged revisions

542. By Gary Poster

propagate merge from gary-2 <- gary-1 <- trunk

541. By gary

push whitespace changes across branches

540. By gary

svn merge -r 108901:108902 svn+ssh://svn.zope.org/repos/main/zc.buildout/branches/gary-2

539. By gary

merge gary-3-options-cleanup with trunk

538. By gary

branch to merge gary-3-options-cleanup with trunk

537. By gary

merge of gary-2-bootstrap-changes into trunk, resolving lots of conflicts with the distribute changes.

536. By gary

look, more branches from Gary!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CHANGES.txt'
--- CHANGES.txt 2010-02-17 21:27:15 +0000
+++ CHANGES.txt 2010-02-17 21:27:15 +0000
@@ -17,6 +17,12 @@
17 * The buildout script generated by bootstrap honors more of the settings17 * The buildout script generated by bootstrap honors more of the settings
18 in the designated configuration file (e.g., buildout.cfg).18 in the designated configuration file (e.g., buildout.cfg).
1919
20Bugs fixed:
21
22- The handling and documenting of default buildout options was normalized.
23 This means, among other things, that ``bin/buildout -vv`` and
24 ``bin/buildout annotate`` correctly list more of the options.
25
201.4.3 (2009-12-10)261.4.3 (2009-12-10)
21==================27==================
2228
2329
=== modified file 'src/zc/buildout/buildout.py'
--- src/zc/buildout/buildout.py 2010-02-17 21:27:15 +0000
+++ src/zc/buildout/buildout.py 2010-02-17 21:27:15 +0000
@@ -112,15 +112,24 @@
112 return data112 return data
113113
114_buildout_default_options = _annotate_section({114_buildout_default_options = _annotate_section({
115 'allow-hosts': '*',
116 'allow-picked-versions': 'true',
117 'bin-directory': 'bin',
118 'develop-eggs-directory': 'develop-eggs',
115 'eggs-directory': 'eggs',119 'eggs-directory': 'eggs',
116 'develop-eggs-directory': 'develop-eggs',120 'executable': sys.executable,
117 'bin-directory': 'bin',121 'find-links': '',
122 'install-from-cache': 'false',
123 'installed': '.installed.cfg',
124 'log-format': '',
125 'log-level': 'INFO',
126 'newest': 'true',
127 'offline': 'false',
118 'parts-directory': 'parts',128 'parts-directory': 'parts',
119 'installed': '.installed.cfg',129 'prefer-final': 'false',
120 'python': 'buildout',130 'python': 'buildout',
121 'executable': sys.executable,131 'unzip': 'false',
122 'log-level': 'INFO',132 'use-dependency-links': 'true',
123 'log-format': '',
124 }, 'DEFAULT_VALUE')133 }, 'DEFAULT_VALUE')
125134
126135
@@ -191,7 +200,7 @@
191 # provide some defaults before options are parsed200 # provide some defaults before options are parsed
192 # because while parsing options those attributes might be201 # because while parsing options those attributes might be
193 # used already (Gottfried Ganssauge)202 # used already (Gottfried Ganssauge)
194 buildout_section = data.get('buildout')203 buildout_section = data['buildout']
195204
196 # Try to make sure we have absolute paths for standard205 # Try to make sure we have absolute paths for standard
197 # directories. We do this before doing substitutions, in case206 # directories. We do this before doing substitutions, in case
@@ -204,22 +213,28 @@
204 d = self._buildout_path(buildout_section[name+'-directory'])213 d = self._buildout_path(buildout_section[name+'-directory'])
205 buildout_section[name+'-directory'] = d214 buildout_section[name+'-directory'] = d
206215
207 links = buildout_section and buildout_section.get('find-links', '')216 # Attributes on this buildout object shouldn't be used by
217 # recipes in their __init__. It can cause bugs, because the
218 # recipes will be instantiated below (``options = self['buildout']``)
219 # before this has completed initializing. These attributes are
220 # left behind for legacy support but recipe authors should
221 # beware of using them. A better practice is for a recipe to
222 # use the buildout['buildout'] options.
223 links = buildout_section['find-links']
208 self._links = links and links.split() or ()224 self._links = links and links.split() or ()
209225 allow_hosts = buildout_section['allow-hosts'].split('\n')
210 allow_hosts = buildout_section and buildout_section.get(
211 'allow-hosts', '*').split('\n')
212 self._allow_hosts = tuple([host.strip() for host in allow_hosts226 self._allow_hosts = tuple([host.strip() for host in allow_hosts
213 if host.strip() != ''])227 if host.strip() != ''])
214
215 self._logger = logging.getLogger('zc.buildout')228 self._logger = logging.getLogger('zc.buildout')
216 self.offline = False229 self.offline = (buildout_section['offline'] == 'true')
217 self.newest = True230 self.newest = (buildout_section['newest'] == 'true')
218231
219 ##################################################################232 ##################################################################
220 ## WARNING!!!233 ## WARNING!!!
221 ## ALL ATTRIBUTES MUST HAVE REASONABLE DEFAULTS AT THIS POINT234 ## ALL ATTRIBUTES MUST HAVE REASONABLE DEFAULTS AT THIS POINT
222 ## OTHERWISE ATTRIBUTEERRORS MIGHT HAPPEN ANY TIME235 ## OTHERWISE ATTRIBUTEERRORS MIGHT HAPPEN ANY TIME FROM RECIPES.
236 ## RECIPES SHOULD GENERALLY USE buildout['buildout'] OPTIONS, NOT
237 ## BUILDOUT ATTRIBUTES.
223 ##################################################################238 ##################################################################
224 # initialize some attrs and buildout directories.239 # initialize some attrs and buildout directories.
225 options = self['buildout']240 options = self['buildout']
@@ -228,7 +243,7 @@
228 links = options.get('find-links', '')243 links = options.get('find-links', '')
229 self._links = links and links.split() or ()244 self._links = links and links.split() or ()
230245
231 allow_hosts = options.get('allow-hosts', '*').split('\n')246 allow_hosts = options['allow-hosts'].split('\n')
232 self._allow_hosts = tuple([host.strip() for host in allow_hosts247 self._allow_hosts = tuple([host.strip() for host in allow_hosts
233 if host.strip() != ''])248 if host.strip() != ''])
234249
@@ -246,44 +261,42 @@
246261
247 self._setup_logging()262 self._setup_logging()
248263
249 offline = options.get('offline', 'false')264 offline = options['offline']
250 if offline not in ('true', 'false'):265 if offline not in ('true', 'false'):
251 self._error('Invalid value for offline option: %s', offline)266 self._error('Invalid value for offline option: %s', offline)
252 options['offline'] = offline267 self.offline = (offline == 'true')
253 self.offline = offline == 'true'
254268
255 if self.offline:269 if self.offline:
256 newest = options['newest'] = 'false'270 newest = options['newest'] = 'false'
257 else:271 else:
258 newest = options.get('newest', 'true')272 newest = options['newest']
259 if newest not in ('true', 'false'):273 if newest not in ('true', 'false'):
260 self._error('Invalid value for newest option: %s', newest)274 self._error('Invalid value for newest option: %s', newest)
261 options['newest'] = newest275 self.newest = (newest == 'true')
262 self.newest = newest == 'true'
263276
264 versions = options.get('versions')277 versions = options.get('versions')
265 if versions:278 if versions:
266 zc.buildout.easy_install.default_versions(dict(self[versions]))279 zc.buildout.easy_install.default_versions(dict(self[versions]))
267280
268 prefer_final = options.get('prefer-final', 'false')281 prefer_final = options['prefer-final']
269 if prefer_final not in ('true', 'false'):282 if prefer_final not in ('true', 'false'):
270 self._error('Invalid value for prefer-final option: %s',283 self._error('Invalid value for prefer-final option: %s',
271 prefer_final)284 prefer_final)
272 zc.buildout.easy_install.prefer_final(prefer_final=='true')285 zc.buildout.easy_install.prefer_final(prefer_final=='true')
273286
274 use_dependency_links = options.get('use-dependency-links', 'true')287 use_dependency_links = options['use-dependency-links']
275 if use_dependency_links not in ('true', 'false'):288 if use_dependency_links not in ('true', 'false'):
276 self._error('Invalid value for use-dependency-links option: %s',289 self._error('Invalid value for use-dependency-links option: %s',
277 use_dependency_links)290 use_dependency_links)
278 zc.buildout.easy_install.use_dependency_links(291 zc.buildout.easy_install.use_dependency_links(
279 use_dependency_links == 'true')292 use_dependency_links == 'true')
280293
281 allow_picked_versions = options.get('allow-picked-versions', 'true')294 allow_picked_versions = options['allow-picked-versions']
282 if allow_picked_versions not in ('true', 'false'):295 if allow_picked_versions not in ('true', 'false'):
283 self._error('Invalid value for allow-picked-versions option: %s',296 self._error('Invalid value for allow-picked-versions option: %s',
284 allow_picked_versions)297 allow_picked_versions)
285 zc.buildout.easy_install.allow_picked_versions(298 zc.buildout.easy_install.allow_picked_versions(
286 allow_picked_versions=='true')299 allow_picked_versions == 'true')
287300
288 download_cache = options.get('download-cache')301 download_cache = options.get('download-cache')
289 if download_cache:302 if download_cache:
@@ -300,22 +313,18 @@
300313
301 zc.buildout.easy_install.download_cache(download_cache)314 zc.buildout.easy_install.download_cache(download_cache)
302315
303 install_from_cache = options.get('install-from-cache')316 install_from_cache = options['install-from-cache']
304 if install_from_cache:317 if install_from_cache not in ('true', 'false'):
305 if install_from_cache not in ('true', 'false'):318 self._error('Invalid value for install-from-cache option: %s',
306 self._error('Invalid value for install-from-cache option: %s',319 install_from_cache)
307 install_from_cache)320 zc.buildout.easy_install.install_from_cache(
308 if install_from_cache == 'true':321 install_from_cache=='true')
309 zc.buildout.easy_install.install_from_cache(True)322
310323 always_unzip = options['unzip']
311324 if always_unzip not in ('true', 'false'):
312 always_unzip = options.get('unzip')325 self._error('Invalid value for unzip option: %s',
313 if always_unzip:326 always_unzip)
314 if always_unzip not in ('true', 'false'):327 zc.buildout.easy_install.always_unzip(always_unzip=='true')
315 self._error('Invalid value for unzip option: %s',
316 always_unzip)
317 if always_unzip == 'true':
318 zc.buildout.easy_install.always_unzip(True)
319328
320 # "Use" each of the defaults so they aren't reported as unused options.329 # "Use" each of the defaults so they aren't reported as unused options.
321 for name in _buildout_default_options:330 for name in _buildout_default_options:
322331
=== modified file 'src/zc/buildout/buildout.txt'
--- src/zc/buildout/buildout.txt 2009-11-06 22:33:23 +0000
+++ src/zc/buildout/buildout.txt 2010-02-17 21:27:15 +0000
@@ -576,7 +576,7 @@
576.. Wait for the file to really disappear. My linux is weird.576.. Wait for the file to really disappear. My linux is weird.
577577
578 >>> wait_until("foo goes away", lambda : not os.path.exists('foo'),578 >>> wait_until("foo goes away", lambda : not os.path.exists('foo'),
579 ... timeout=100)579 ... timeout=200)
580580
581we get the same error, but we don't get the directory left behind:581we get the same error, but we don't get the directory left behind:
582582
@@ -724,6 +724,10 @@
724 ==================724 ==================
725 <BLANKLINE>725 <BLANKLINE>
726 [buildout]726 [buildout]
727 allow-hosts= *
728 DEFAULT_VALUE
729 allow-picked-versions= true
730 DEFAULT_VALUE
727 bin-directory= bin731 bin-directory= bin
728 DEFAULT_VALUE732 DEFAULT_VALUE
729 develop= recipes733 develop= recipes
@@ -736,18 +740,32 @@
736 DEFAULT_VALUE740 DEFAULT_VALUE
737 executable= ...741 executable= ...
738 DEFAULT_VALUE742 DEFAULT_VALUE
743 find-links=
744 DEFAULT_VALUE
745 install-from-cache= false
746 DEFAULT_VALUE
739 installed= .installed.cfg747 installed= .installed.cfg
740 DEFAULT_VALUE748 DEFAULT_VALUE
741 log-format=749 log-format=
742 DEFAULT_VALUE750 DEFAULT_VALUE
743 log-level= INFO751 log-level= INFO
744 DEFAULT_VALUE752 DEFAULT_VALUE
753 newest= true
754 DEFAULT_VALUE
755 offline= false
756 DEFAULT_VALUE
745 parts= data-dir757 parts= data-dir
746 /sample-buildout/buildout.cfg758 /sample-buildout/buildout.cfg
747 parts-directory= parts759 parts-directory= parts
748 DEFAULT_VALUE760 DEFAULT_VALUE
761 prefer-final= false
762 DEFAULT_VALUE
749 python= buildout763 python= buildout
750 DEFAULT_VALUE764 DEFAULT_VALUE
765 unzip= false
766 DEFAULT_VALUE
767 use-dependency-links= true
768 DEFAULT_VALUE
751 <BLANKLINE>769 <BLANKLINE>
752 [data-dir]770 [data-dir]
753 path= foo bins771 path= foo bins
@@ -2194,17 +2212,21 @@
21942212
2195 >>> print system(buildout+' -vv'), # doctest: +NORMALIZE_WHITESPACE2213 >>> print system(buildout+' -vv'), # doctest: +NORMALIZE_WHITESPACE
2196 Installing 'zc.buildout', 'setuptools'.2214 Installing 'zc.buildout', 'setuptools'.
2197 We have a develop egg: zc.buildout 1.0.0.2215 We have a develop egg: zc.buildout X.X.
2198 We have the best distribution that satisfies 'setuptools'.2216 We have the best distribution that satisfies 'setuptools'.
2199 Picked: setuptools = 0.62217 Picked: setuptools = V.V
2200 <BLANKLINE>2218 <BLANKLINE>
2201 Configuration data:2219 Configuration data:
2202 [buildout]2220 [buildout]
2221 allow-hosts = *
2222 allow-picked-versions = true
2203 bin-directory = /sample-buildout/bin2223 bin-directory = /sample-buildout/bin
2204 develop-eggs-directory = /sample-buildout/develop-eggs2224 develop-eggs-directory = /sample-buildout/develop-eggs
2205 directory = /sample-buildout2225 directory = /sample-buildout
2206 eggs-directory = /sample-buildout/eggs2226 eggs-directory = /sample-buildout/eggs
2207 executable = /usr/local/bin/python2.32227 executable = python
2228 find-links =
2229 install-from-cache = false
2208 installed = /sample-buildout/.installed.cfg2230 installed = /sample-buildout/.installed.cfg
2209 log-format =2231 log-format =
2210 log-level = INFO2232 log-level = INFO
@@ -2212,7 +2234,10 @@
2212 offline = false2234 offline = false
2213 parts =2235 parts =
2214 parts-directory = /sample-buildout/parts2236 parts-directory = /sample-buildout/parts
2237 prefer-final = false
2215 python = buildout2238 python = buildout
2239 unzip = false
2240 use-dependency-links = true
2216 verbosity = 202241 verbosity = 20
2217 <BLANKLINE>2242 <BLANKLINE>
22182243
@@ -2220,6 +2245,37 @@
2220command-line assignments. We've discussed most of these options2245command-line assignments. We've discussed most of these options
2221already, but let's review them and touch on some we haven't discussed:2246already, but let's review them and touch on some we haven't discussed:
22222247
2248allow-hosts
2249 On some environments the links visited by `zc.buildout` can be forbidden by
2250 paranoid firewalls. These URLs might be in the chain of links visited by
2251 `zc.buildout` as defined by buildout's `find-links` option, or as defined
2252 by various eggs in their `url`, `download_url`, `dependency_links` metadata.
2253
2254 The fact that package_index works like a spider and might visit links and
2255 go to other locations makes this even harder.
2256
2257 The `allow-hosts` option provides a way to prevent this, and
2258 works exactly like the one provided in `easy_install`.
2259
2260 You can provide a list of allowed host, together with wildcards::
2261
2262 [buildout]
2263 ...
2264
2265 allow-hosts =
2266 *.python.org
2267 example.com
2268
2269 All URLs that does not match these hosts will not be visited.
2270
2271allow-picked-versions
2272 By default, the buildout will choose the best match for a given requirement
2273 if the requirement is not specified precisely (for instance, using the
2274 "versions" option. This behavior corresponds to the
2275 "allow-picked-versions" being set to its default value, "true". If
2276 "allow-picked-versions" is "false," instead of picking the best match,
2277 buildout will raise an error. This helps enforce repeatability.
2278
2223bin-directory2279bin-directory
2224 The directory path where scripts are written. This can be a2280 The directory path where scripts are written. This can be a
2225 relative path, which is interpreted relative to the directory2281 relative path, which is interpreted relative to the directory
@@ -2244,6 +2300,47 @@
2244 The Python executable used to run the buildout. See the python2300 The Python executable used to run the buildout. See the python
2245 option below.2301 option below.
22462302
2303find-links
2304 You can specify more locations to search for distributions using the
2305 `find-links` option. All locations specified will be searched for
2306 distributions along with the package index as described before.
2307
2308 Locations can be urls::
2309
2310 [buildout]
2311 ...
2312 find-links = http://download.zope.org/distribution/
2313
2314 They can also be directories on disk::
2315
2316 [buildout]
2317 ...
2318 find-links = /some/path
2319
2320 Finally, they can also be direct paths to distributions::
2321
2322 [buildout]
2323 ...
2324 find-links = /some/path/someegg-1.0.0-py2.3.egg
2325
2326 Any number of locations can be specified in the `find-links` option::
2327
2328 [buildout]
2329 ...
2330 find-links =
2331 http://download.zope.org/distribution/
2332 /some/otherpath
2333 /some/path/someegg-1.0.0-py2.3.egg
2334
2335install-from-cache
2336 A download cache can be used as the basis of application source releases.
2337 In an application source release, we want to distribute an application that
2338 can be built without making any network accesses. In this case, we
2339 distribute a buildout with download cache and tell the buildout to install
2340 from the download cache only, without making network accesses. The
2341 buildout install-from-cache option can be used to signal that packages
2342 should be installed only from the download cache.
2343
2247installed2344installed
2248 The file path where information about the results of the previous2345 The file path where information about the results of the previous
2249 buildout run is written. This can be a relative path, which is2346 buildout run is written. This can be a relative path, which is
@@ -2257,12 +2354,51 @@
2257log-level2354log-level
2258 The log level before verbosity adjustment2355 The log level before verbosity adjustment
22592356
2357newest
2358 By default buildout and recipes will try to find the newest versions of
2359 distributions needed to satisfy requirements. This can be very time
2360 consuming, especially when incrementally working on setting up a buildout
2361 or working on a recipe. The buildout "newest" option can be used to to
2362 suppress this. If the "newest" option is set to false, then new
2363 distributions won't be sought if an installed distribution meets
2364 requirements. The "newest" option can also be set to false using the -N
2365 command-line option. See also the "offline" option.
2366
2367offline
2368 The "offline" option goes a bit further than the "newest" option. If the
2369 buildout "offline" option is given a value of "true", the buildout and
2370 recipes that are aware of the option will avoid doing network access. This
2371 is handy when running the buildout when not connected to the internet. It
2372 also makes buildouts run much faster. This option is typically set using
2373 the buildout -o option.
2374
2260parts2375parts
2261 A white space separated list of parts to be installed.2376 A white space separated list of parts to be installed.
22622377
2263parts-directory2378parts-directory
2264 A working directory that parts can used to store data.2379 A working directory that parts can used to store data.
22652380
2381prefer-final
2382 Currently, when searching for new releases, the newest available
2383 release is used. This isn't usually ideal, as you may get a
2384 development release or alpha releases not ready to be widely used.
2385 You can request that final releases be preferred using the prefer
2386 final option in the buildout section::
2387
2388 [buildout]
2389 ...
2390 prefer-final = true
2391
2392 When the prefer-final option is set to true, then when searching for
2393 new releases, final releases are preferred. If there are final
2394 releases that satisfy distribution requirements, then those releases
2395 are used even if newer non-final releases are available. The buildout
2396 prefer-final option can be used to override this behavior.
2397
2398 In buildout version 2, final releases will be preferred by default.
2399 You will then need to use a false value for prefer-final to get the
2400 newest releases.
2401
2266python2402python
2267 The name of a section containing information about the default2403 The name of a section containing information about the default
2268 Python interpreter. Recipes that need a installation2404 Python interpreter. Recipes that need a installation
@@ -2273,6 +2409,26 @@
2273 Python executable. By default, the buildout section defines the2409 Python executable. By default, the buildout section defines the
2274 default Python as the Python used to run the buildout.2410 default Python as the Python used to run the buildout.
22752411
2412unzip
2413 By default, zc.buildout doesn't unzip zip-safe eggs ("unzip = false").
2414 This follows the policy followed by setuptools itself. Experience shows
2415 this policy to to be inconvenient. Zipped eggs make debugging more
2416 difficult and often import more slowly. You can include an unzip option in
2417 the buildout section to change the default unzipping policy ("unzip =
2418 true").
2419
2420use-dependency-links
2421 By default buildout will obey the setuptools dependency_links metadata
2422 when it looks for dependencies. This behavior can be controlled with
2423 the use-dependency-links buildout option::
2424
2425 [buildout]
2426 ...
2427 use-dependency-links = false
2428
2429 The option defaults to true. If you set it to false, then dependency
2430 links are only looked for in the locations specified by find-links.
2431
2276verbosity2432verbosity
2277 A log-level adjustment. Typically, this is set via the -q and -v2433 A log-level adjustment. Typically, this is set via the -q and -v
2278 command-line options.2434 command-line options.
@@ -2351,48 +2507,6 @@
2351 Generated script '/sample-bootstrapped2/bin/buildout'.2507 Generated script '/sample-bootstrapped2/bin/buildout'.
23522508
23532509
2354Newest and Offline Modes
2355------------------------
2356
2357By default buildout and recipes will try to find the newest versions
2358of distributions needed to satisfy requirements. This can be very
2359time consuming, especially when incrementally working on setting up a
2360buildout or working on a recipe. The buildout newest option can be
2361used to to suppress this. If the newest option is set to false, then
2362new distributions won't be sought if an installed distribution meets
2363requirements. The newest option can be set to false using the -N
2364command-line option.
2365
2366The offline option goes a bit further. If the buildout offline option
2367is given a value of "true", the buildout and recipes that are aware of
2368the option will avoid doing network access. This is handy when
2369running the buildout when not connected to the internet. It also
2370makes buildouts run much faster. This option is typically set using
2371the buildout -o option.
2372
2373Preferring Final Releases
2374-------------------------
2375
2376Currently, when searching for new releases, the newest available
2377release is used. This isn't usually ideal, as you may get a
2378development release or alpha releases not ready to be widely used.
2379You can request that final releases be preferred using the prefer
2380final option in the buildout section::
2381
2382 [buildout]
2383 ...
2384 prefer-final = true
2385
2386When the prefer-final option is set to true, then when searching for
2387new releases, final releases are preferred. If there are final
2388releases that satisfy distribution requirements, then those releases
2389are used even if newer non-final releases are available. The buildout
2390prefer-final option can be used to override this behavior.
2391
2392In buildout version 2, final releases will be preferred by default.
2393You will then need to use a false value for prefer-final to get the
2394newest releases.
2395
2396Finding distributions2510Finding distributions
2397---------------------2511---------------------
23982512
@@ -2411,49 +2525,7 @@
2411requirements of the buildout will always be used.2525requirements of the buildout will always be used.
24122526
2413You can also specify more locations to search for distributions using2527You can also specify more locations to search for distributions using
2414the `find-links` option. All locations specified will be searched for2528the `find-links` option. See its description above.
2415distributions along with the package index as described before.
2416
2417Locations can be urls::
2418
2419 [buildout]
2420 ...
2421 find-links = http://download.zope.org/distribution/
2422
2423They can also be directories on disk::
2424
2425 [buildout]
2426 ...
2427 find-links = /some/path
2428
2429Finally, they can also be direct paths to distributions::
2430
2431 [buildout]
2432 ...
2433 find-links = /some/path/someegg-1.0.0-py2.3.egg
2434
2435Any number of locations can be specified in the `find-links` option::
2436
2437 [buildout]
2438 ...
2439 find-links =
2440 http://download.zope.org/distribution/
2441 /some/otherpath
2442 /some/path/someegg-1.0.0-py2.3.egg
2443
2444Dependency links
2445----------------
2446
2447By default buildout will obey the setuptools dependency_links metadata
2448when it looks for dependencies. This behavior can be controlled with
2449the use-dependency-links buildout option::
2450
2451 [buildout]
2452 ...
2453 use-dependency-links = false
2454
2455The option defaults to true. If you set it to false, then dependency
2456links are only looked for in the locations specified by find-links.
24572529
2458Controlling the installation database2530Controlling the installation database
2459-------------------------------------2531-------------------------------------
@@ -2615,37 +2687,11 @@
2615 Develop: '/sample-bootstrapped/demo'2687 Develop: '/sample-bootstrapped/demo'
2616 unload ['buildout']2688 unload ['buildout']
26172689
2618Allow hosts
2619-----------
2620
2621On some environments the links visited by `zc.buildout` can be forbidden
2622by paranoiac firewalls. These URL might be on the chain of links
2623visited by `zc.buildout` wheter they are defined in the `find-links` option,
2624wheter they are defined by various eggs in their `url`, `download_url`,
2625`dependency_links` metadata.
2626
2627It is even harder to track that package_index works like a spider and
2628might visit links and go to other location.
2629
2630The `allow-hosts` option provides a way to prevent this, and
2631works exactly like the one provided in `easy_install`.
2632
2633You can provide a list of allowed host, together with wildcards::
2634
2635 [buildout]
2636 ...
2637
2638 allow-hosts =
2639 *.python.org
2640 example.com
2641
2642All urls that does not match these hosts will not be visited.
2643
2644.. [#future_recipe_methods] In the future, additional methods may be2690.. [#future_recipe_methods] In the future, additional methods may be
2645 added. Older recipes with fewer methods will still be2691 added. Older recipes with fewer methods will still be
2646 supported.2692 supported.
26472693
2648.. [#packaging_info] If we wanted to create a distribution from this2694.. [#packaging_info] If we wanted to create a distribution from this
2649 package, we would need specify much more information. See the2695 package, we would need to specify much more information. See the
2650 `setuptools documentation2696 `setuptools documentation
2651 <http://peak.telecommunity.com/DevCenter/setuptools>`_.2697 <http://peak.telecommunity.com/DevCenter/setuptools>`_.
26522698
=== modified file 'src/zc/buildout/tests.py'
--- src/zc/buildout/tests.py 2010-02-17 21:27:15 +0000
+++ src/zc/buildout/tests.py 2010-02-17 21:27:15 +0000
@@ -2981,6 +2981,9 @@
2981 '-q develop -mxN -d /sample-buildout/develop-eggs'2981 '-q develop -mxN -d /sample-buildout/develop-eggs'
2982 ),2982 ),
2983 (re.compile(r'^[*]...'), '...'),2983 (re.compile(r'^[*]...'), '...'),
2984 # for bug_92891_bootstrap_crashes_with_egg_recipe_in_buildout_section
2985 (re.compile(r"Unused options for buildout: 'eggs' 'scripts'\."),
2986 "Unused options for buildout: 'scripts' 'eggs'."),
2984 ]),2987 ]),
2985 ),2988 ),
2986 zc.buildout.testselectingpython.test_suite(),2989 zc.buildout.testselectingpython.test_suite(),
29872990
=== modified file 'zc.recipe.egg_/src/zc/recipe/egg/egg.py'
--- zc.recipe.egg_/src/zc/recipe/egg/egg.py 2009-11-06 22:33:23 +0000
+++ zc.recipe.egg_/src/zc/recipe/egg/egg.py 2010-02-17 21:27:15 +0000
@@ -25,8 +25,8 @@
25 self.buildout = buildout25 self.buildout = buildout
26 self.name = name26 self.name = name
27 self.options = options27 self.options = options
28 links = options.get('find-links',28 b_options = buildout['buildout']
29 buildout['buildout'].get('find-links'))29 links = options.get('find-links', b_options['find-links'])
30 if links:30 if links:
31 links = links.split()31 links = links.split()
32 options['find-links'] = '\n'.join(links)32 options['find-links'] = '\n'.join(links)
@@ -34,25 +34,25 @@
34 links = ()34 links = ()
35 self.links = links35 self.links = links
3636
37 index = options.get('index', buildout['buildout'].get('index'))37 index = options.get('index', b_options.get('index'))
38 if index is not None:38 if index is not None:
39 options['index'] = index39 options['index'] = index
40 self.index = index40 self.index = index
4141
42 allow_hosts = buildout['buildout'].get('allow-hosts', '*')42 allow_hosts = b_options['allow-hosts']
43 allow_hosts = tuple([host.strip() for host in allow_hosts.split('\n')43 allow_hosts = tuple([host.strip() for host in allow_hosts.split('\n')
44 if host.strip()!=''])44 if host.strip()!=''])
45 self.allow_hosts = allow_hosts45 self.allow_hosts = allow_hosts
4646
47 options['eggs-directory'] = buildout['buildout']['eggs-directory']47 options['eggs-directory'] = b_options['eggs-directory']
48 options['_e'] = options['eggs-directory'] # backward compat.48 options['_e'] = options['eggs-directory'] # backward compat.
49 options['develop-eggs-directory'49 options['develop-eggs-directory'] = b_options['develop-eggs-directory']
50 ] = buildout['buildout']['develop-eggs-directory']
51 options['_d'] = options['develop-eggs-directory'] # backward compat.50 options['_d'] = options['develop-eggs-directory'] # backward compat.
5251
53 assert options.get('unzip') in ('true', 'false', None)52 # verify that this is None, 'true' or 'false'
53 get_bool(options, 'unzip')
5454
55 python = options.get('python', buildout['buildout']['python'])55 python = options.get('python', b_options['python'])
56 options['executable'] = buildout[python]['executable']56 options['executable'] = buildout[python]['executable']
5757
58 def working_set(self, extra=()):58 def working_set(self, extra=()):
@@ -61,6 +61,7 @@
61 This is intended for reuse by similar recipes.61 This is intended for reuse by similar recipes.
62 """62 """
63 options = self.options63 options = self.options
64 b_options = self.buildout['buildout']
6465
65 distributions = [66 distributions = [
66 r.strip()67 r.strip()
@@ -76,9 +77,8 @@
76 )77 )
77 else:78 else:
78 kw = {}79 kw = {}
79 if options.get('unzip'):80 if 'unzip' in options:
80 kw['always_unzip'] = get_bool(options, 'unzip')81 kw['always_unzip'] = get_bool(options, 'unzip')
81
82 ws = zc.buildout.easy_install.install(82 ws = zc.buildout.easy_install.install(
83 distributions, options['eggs-directory'],83 distributions, options['eggs-directory'],
84 links=self.links,84 links=self.links,

Subscribers

People subscribed via source and target branches

to all changes: