Merge lp:~gary/zc.buildout/python-support-3-options into lp:zc.buildout
- python-support-3-options
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Francis J. Lacoste (community) | Approve | ||
Review via email: mp+19539@code.launchpad.net |
Commit message
Description of the change
- 542. By Gary Poster
-
propagate merge from gary-2 <- gary-1 <- trunk
Francis J. Lacoste (flacoste) wrote : | # |
Hi Gary,
Everything looks fine, the only snippet I don't understand is that one
> === modified file 'src/zc/
> --- src/zc/
> +++ src/zc/
> @@ -2981,6 +2981,9 @@
> '-q develop -mxN -d /sample-
> ),
> (re.compile(
> + # for bug_92891_
> + (re.compile(
> + "Unused options for buildout: 'scripts' 'eggs'."),
> ]),
> ),
> zc.buildout.
>
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
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
1 | === modified file 'CHANGES.txt' | |||
2 | --- CHANGES.txt 2010-02-17 21:27:15 +0000 | |||
3 | +++ CHANGES.txt 2010-02-17 21:27:15 +0000 | |||
4 | @@ -17,6 +17,12 @@ | |||
5 | 17 | * The buildout script generated by bootstrap honors more of the settings | 17 | * The buildout script generated by bootstrap honors more of the settings |
6 | 18 | in the designated configuration file (e.g., buildout.cfg). | 18 | in the designated configuration file (e.g., buildout.cfg). |
7 | 19 | 19 | ||
8 | 20 | Bugs fixed: | ||
9 | 21 | |||
10 | 22 | - The handling and documenting of default buildout options was normalized. | ||
11 | 23 | This means, among other things, that ``bin/buildout -vv`` and | ||
12 | 24 | ``bin/buildout annotate`` correctly list more of the options. | ||
13 | 25 | |||
14 | 20 | 1.4.3 (2009-12-10) | 26 | 1.4.3 (2009-12-10) |
15 | 21 | ================== | 27 | ================== |
16 | 22 | 28 | ||
17 | 23 | 29 | ||
18 | === modified file 'src/zc/buildout/buildout.py' | |||
19 | --- src/zc/buildout/buildout.py 2010-02-17 21:27:15 +0000 | |||
20 | +++ src/zc/buildout/buildout.py 2010-02-17 21:27:15 +0000 | |||
21 | @@ -112,15 +112,24 @@ | |||
22 | 112 | return data | 112 | return data |
23 | 113 | 113 | ||
24 | 114 | _buildout_default_options = _annotate_section({ | 114 | _buildout_default_options = _annotate_section({ |
25 | 115 | 'allow-hosts': '*', | ||
26 | 116 | 'allow-picked-versions': 'true', | ||
27 | 117 | 'bin-directory': 'bin', | ||
28 | 118 | 'develop-eggs-directory': 'develop-eggs', | ||
29 | 115 | 'eggs-directory': 'eggs', | 119 | 'eggs-directory': 'eggs', |
32 | 116 | 'develop-eggs-directory': 'develop-eggs', | 120 | 'executable': sys.executable, |
33 | 117 | 'bin-directory': 'bin', | 121 | 'find-links': '', |
34 | 122 | 'install-from-cache': 'false', | ||
35 | 123 | 'installed': '.installed.cfg', | ||
36 | 124 | 'log-format': '', | ||
37 | 125 | 'log-level': 'INFO', | ||
38 | 126 | 'newest': 'true', | ||
39 | 127 | 'offline': 'false', | ||
40 | 118 | 'parts-directory': 'parts', | 128 | 'parts-directory': 'parts', |
42 | 119 | 'installed': '.installed.cfg', | 129 | 'prefer-final': 'false', |
43 | 120 | 'python': 'buildout', | 130 | 'python': 'buildout', |
47 | 121 | 'executable': sys.executable, | 131 | 'unzip': 'false', |
48 | 122 | 'log-level': 'INFO', | 132 | 'use-dependency-links': 'true', |
46 | 123 | 'log-format': '', | ||
49 | 124 | }, 'DEFAULT_VALUE') | 133 | }, 'DEFAULT_VALUE') |
50 | 125 | 134 | ||
51 | 126 | 135 | ||
52 | @@ -191,7 +200,7 @@ | |||
53 | 191 | # provide some defaults before options are parsed | 200 | # provide some defaults before options are parsed |
54 | 192 | # because while parsing options those attributes might be | 201 | # because while parsing options those attributes might be |
55 | 193 | # used already (Gottfried Ganssauge) | 202 | # used already (Gottfried Ganssauge) |
57 | 194 | buildout_section = data.get('buildout') | 203 | buildout_section = data['buildout'] |
58 | 195 | 204 | ||
59 | 196 | # Try to make sure we have absolute paths for standard | 205 | # Try to make sure we have absolute paths for standard |
60 | 197 | # directories. We do this before doing substitutions, in case | 206 | # directories. We do this before doing substitutions, in case |
61 | @@ -204,22 +213,28 @@ | |||
62 | 204 | d = self._buildout_path(buildout_section[name+'-directory']) | 213 | d = self._buildout_path(buildout_section[name+'-directory']) |
63 | 205 | buildout_section[name+'-directory'] = d | 214 | buildout_section[name+'-directory'] = d |
64 | 206 | 215 | ||
66 | 207 | links = buildout_section and buildout_section.get('find-links', '') | 216 | # Attributes on this buildout object shouldn't be used by |
67 | 217 | # recipes in their __init__. It can cause bugs, because the | ||
68 | 218 | # recipes will be instantiated below (``options = self['buildout']``) | ||
69 | 219 | # before this has completed initializing. These attributes are | ||
70 | 220 | # left behind for legacy support but recipe authors should | ||
71 | 221 | # beware of using them. A better practice is for a recipe to | ||
72 | 222 | # use the buildout['buildout'] options. | ||
73 | 223 | links = buildout_section['find-links'] | ||
74 | 208 | self._links = links and links.split() or () | 224 | self._links = links and links.split() or () |
78 | 209 | 225 | allow_hosts = buildout_section['allow-hosts'].split('\n') | |
76 | 210 | allow_hosts = buildout_section and buildout_section.get( | ||
77 | 211 | 'allow-hosts', '*').split('\n') | ||
79 | 212 | self._allow_hosts = tuple([host.strip() for host in allow_hosts | 226 | self._allow_hosts = tuple([host.strip() for host in allow_hosts |
80 | 213 | if host.strip() != '']) | 227 | if host.strip() != '']) |
81 | 214 | |||
82 | 215 | self._logger = logging.getLogger('zc.buildout') | 228 | self._logger = logging.getLogger('zc.buildout') |
85 | 216 | self.offline = False | 229 | self.offline = (buildout_section['offline'] == 'true') |
86 | 217 | self.newest = True | 230 | self.newest = (buildout_section['newest'] == 'true') |
87 | 218 | 231 | ||
88 | 219 | ################################################################## | 232 | ################################################################## |
89 | 220 | ## WARNING!!! | 233 | ## WARNING!!! |
90 | 221 | ## ALL ATTRIBUTES MUST HAVE REASONABLE DEFAULTS AT THIS POINT | 234 | ## ALL ATTRIBUTES MUST HAVE REASONABLE DEFAULTS AT THIS POINT |
92 | 222 | ## OTHERWISE ATTRIBUTEERRORS MIGHT HAPPEN ANY TIME | 235 | ## OTHERWISE ATTRIBUTEERRORS MIGHT HAPPEN ANY TIME FROM RECIPES. |
93 | 236 | ## RECIPES SHOULD GENERALLY USE buildout['buildout'] OPTIONS, NOT | ||
94 | 237 | ## BUILDOUT ATTRIBUTES. | ||
95 | 223 | ################################################################## | 238 | ################################################################## |
96 | 224 | # initialize some attrs and buildout directories. | 239 | # initialize some attrs and buildout directories. |
97 | 225 | options = self['buildout'] | 240 | options = self['buildout'] |
98 | @@ -228,7 +243,7 @@ | |||
99 | 228 | links = options.get('find-links', '') | 243 | links = options.get('find-links', '') |
100 | 229 | self._links = links and links.split() or () | 244 | self._links = links and links.split() or () |
101 | 230 | 245 | ||
103 | 231 | allow_hosts = options.get('allow-hosts', '*').split('\n') | 246 | allow_hosts = options['allow-hosts'].split('\n') |
104 | 232 | self._allow_hosts = tuple([host.strip() for host in allow_hosts | 247 | self._allow_hosts = tuple([host.strip() for host in allow_hosts |
105 | 233 | if host.strip() != '']) | 248 | if host.strip() != '']) |
106 | 234 | 249 | ||
107 | @@ -246,44 +261,42 @@ | |||
108 | 246 | 261 | ||
109 | 247 | self._setup_logging() | 262 | self._setup_logging() |
110 | 248 | 263 | ||
112 | 249 | offline = options.get('offline', 'false') | 264 | offline = options['offline'] |
113 | 250 | if offline not in ('true', 'false'): | 265 | if offline not in ('true', 'false'): |
114 | 251 | self._error('Invalid value for offline option: %s', offline) | 266 | self._error('Invalid value for offline option: %s', offline) |
117 | 252 | options['offline'] = offline | 267 | self.offline = (offline == 'true') |
116 | 253 | self.offline = offline == 'true' | ||
118 | 254 | 268 | ||
119 | 255 | if self.offline: | 269 | if self.offline: |
120 | 256 | newest = options['newest'] = 'false' | 270 | newest = options['newest'] = 'false' |
121 | 257 | else: | 271 | else: |
123 | 258 | newest = options.get('newest', 'true') | 272 | newest = options['newest'] |
124 | 259 | if newest not in ('true', 'false'): | 273 | if newest not in ('true', 'false'): |
125 | 260 | self._error('Invalid value for newest option: %s', newest) | 274 | self._error('Invalid value for newest option: %s', newest) |
128 | 261 | options['newest'] = newest | 275 | self.newest = (newest == 'true') |
127 | 262 | self.newest = newest == 'true' | ||
129 | 263 | 276 | ||
130 | 264 | versions = options.get('versions') | 277 | versions = options.get('versions') |
131 | 265 | if versions: | 278 | if versions: |
132 | 266 | zc.buildout.easy_install.default_versions(dict(self[versions])) | 279 | zc.buildout.easy_install.default_versions(dict(self[versions])) |
133 | 267 | 280 | ||
135 | 268 | prefer_final = options.get('prefer-final', 'false') | 281 | prefer_final = options['prefer-final'] |
136 | 269 | if prefer_final not in ('true', 'false'): | 282 | if prefer_final not in ('true', 'false'): |
137 | 270 | self._error('Invalid value for prefer-final option: %s', | 283 | self._error('Invalid value for prefer-final option: %s', |
138 | 271 | prefer_final) | 284 | prefer_final) |
139 | 272 | zc.buildout.easy_install.prefer_final(prefer_final=='true') | 285 | zc.buildout.easy_install.prefer_final(prefer_final=='true') |
140 | 273 | 286 | ||
142 | 274 | use_dependency_links = options.get('use-dependency-links', 'true') | 287 | use_dependency_links = options['use-dependency-links'] |
143 | 275 | if use_dependency_links not in ('true', 'false'): | 288 | if use_dependency_links not in ('true', 'false'): |
144 | 276 | self._error('Invalid value for use-dependency-links option: %s', | 289 | self._error('Invalid value for use-dependency-links option: %s', |
145 | 277 | use_dependency_links) | 290 | use_dependency_links) |
146 | 278 | zc.buildout.easy_install.use_dependency_links( | 291 | zc.buildout.easy_install.use_dependency_links( |
147 | 279 | use_dependency_links == 'true') | 292 | use_dependency_links == 'true') |
148 | 280 | 293 | ||
150 | 281 | allow_picked_versions = options.get('allow-picked-versions', 'true') | 294 | allow_picked_versions = options['allow-picked-versions'] |
151 | 282 | if allow_picked_versions not in ('true', 'false'): | 295 | if allow_picked_versions not in ('true', 'false'): |
152 | 283 | self._error('Invalid value for allow-picked-versions option: %s', | 296 | self._error('Invalid value for allow-picked-versions option: %s', |
153 | 284 | allow_picked_versions) | 297 | allow_picked_versions) |
154 | 285 | zc.buildout.easy_install.allow_picked_versions( | 298 | zc.buildout.easy_install.allow_picked_versions( |
156 | 286 | allow_picked_versions=='true') | 299 | allow_picked_versions == 'true') |
157 | 287 | 300 | ||
158 | 288 | download_cache = options.get('download-cache') | 301 | download_cache = options.get('download-cache') |
159 | 289 | if download_cache: | 302 | if download_cache: |
160 | @@ -300,22 +313,18 @@ | |||
161 | 300 | 313 | ||
162 | 301 | zc.buildout.easy_install.download_cache(download_cache) | 314 | zc.buildout.easy_install.download_cache(download_cache) |
163 | 302 | 315 | ||
180 | 303 | install_from_cache = options.get('install-from-cache') | 316 | install_from_cache = options['install-from-cache'] |
181 | 304 | if install_from_cache: | 317 | if install_from_cache not in ('true', 'false'): |
182 | 305 | if install_from_cache not in ('true', 'false'): | 318 | self._error('Invalid value for install-from-cache option: %s', |
183 | 306 | self._error('Invalid value for install-from-cache option: %s', | 319 | install_from_cache) |
184 | 307 | install_from_cache) | 320 | zc.buildout.easy_install.install_from_cache( |
185 | 308 | if install_from_cache == 'true': | 321 | install_from_cache=='true') |
186 | 309 | zc.buildout.easy_install.install_from_cache(True) | 322 | |
187 | 310 | 323 | always_unzip = options['unzip'] | |
188 | 311 | 324 | if always_unzip not in ('true', 'false'): | |
189 | 312 | always_unzip = options.get('unzip') | 325 | self._error('Invalid value for unzip option: %s', |
190 | 313 | if always_unzip: | 326 | always_unzip) |
191 | 314 | if always_unzip not in ('true', 'false'): | 327 | zc.buildout.easy_install.always_unzip(always_unzip=='true') |
176 | 315 | self._error('Invalid value for unzip option: %s', | ||
177 | 316 | always_unzip) | ||
178 | 317 | if always_unzip == 'true': | ||
179 | 318 | zc.buildout.easy_install.always_unzip(True) | ||
192 | 319 | 328 | ||
193 | 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. |
194 | 321 | for name in _buildout_default_options: | 330 | for name in _buildout_default_options: |
195 | 322 | 331 | ||
196 | === modified file 'src/zc/buildout/buildout.txt' | |||
197 | --- src/zc/buildout/buildout.txt 2009-11-06 22:33:23 +0000 | |||
198 | +++ src/zc/buildout/buildout.txt 2010-02-17 21:27:15 +0000 | |||
199 | @@ -576,7 +576,7 @@ | |||
200 | 576 | .. Wait for the file to really disappear. My linux is weird. | 576 | .. Wait for the file to really disappear. My linux is weird. |
201 | 577 | 577 | ||
202 | 578 | >>> wait_until("foo goes away", lambda : not os.path.exists('foo'), | 578 | >>> wait_until("foo goes away", lambda : not os.path.exists('foo'), |
204 | 579 | ... timeout=100) | 579 | ... timeout=200) |
205 | 580 | 580 | ||
206 | 581 | we get the same error, but we don't get the directory left behind: | 581 | we get the same error, but we don't get the directory left behind: |
207 | 582 | 582 | ||
208 | @@ -724,6 +724,10 @@ | |||
209 | 724 | ================== | 724 | ================== |
210 | 725 | <BLANKLINE> | 725 | <BLANKLINE> |
211 | 726 | [buildout] | 726 | [buildout] |
212 | 727 | allow-hosts= * | ||
213 | 728 | DEFAULT_VALUE | ||
214 | 729 | allow-picked-versions= true | ||
215 | 730 | DEFAULT_VALUE | ||
216 | 727 | bin-directory= bin | 731 | bin-directory= bin |
217 | 728 | DEFAULT_VALUE | 732 | DEFAULT_VALUE |
218 | 729 | develop= recipes | 733 | develop= recipes |
219 | @@ -736,18 +740,32 @@ | |||
220 | 736 | DEFAULT_VALUE | 740 | DEFAULT_VALUE |
221 | 737 | executable= ... | 741 | executable= ... |
222 | 738 | DEFAULT_VALUE | 742 | DEFAULT_VALUE |
223 | 743 | find-links= | ||
224 | 744 | DEFAULT_VALUE | ||
225 | 745 | install-from-cache= false | ||
226 | 746 | DEFAULT_VALUE | ||
227 | 739 | installed= .installed.cfg | 747 | installed= .installed.cfg |
228 | 740 | DEFAULT_VALUE | 748 | DEFAULT_VALUE |
229 | 741 | log-format= | 749 | log-format= |
230 | 742 | DEFAULT_VALUE | 750 | DEFAULT_VALUE |
231 | 743 | log-level= INFO | 751 | log-level= INFO |
232 | 744 | DEFAULT_VALUE | 752 | DEFAULT_VALUE |
233 | 753 | newest= true | ||
234 | 754 | DEFAULT_VALUE | ||
235 | 755 | offline= false | ||
236 | 756 | DEFAULT_VALUE | ||
237 | 745 | parts= data-dir | 757 | parts= data-dir |
238 | 746 | /sample-buildout/buildout.cfg | 758 | /sample-buildout/buildout.cfg |
239 | 747 | parts-directory= parts | 759 | parts-directory= parts |
240 | 748 | DEFAULT_VALUE | 760 | DEFAULT_VALUE |
241 | 761 | prefer-final= false | ||
242 | 762 | DEFAULT_VALUE | ||
243 | 749 | python= buildout | 763 | python= buildout |
244 | 750 | DEFAULT_VALUE | 764 | DEFAULT_VALUE |
245 | 765 | unzip= false | ||
246 | 766 | DEFAULT_VALUE | ||
247 | 767 | use-dependency-links= true | ||
248 | 768 | DEFAULT_VALUE | ||
249 | 751 | <BLANKLINE> | 769 | <BLANKLINE> |
250 | 752 | [data-dir] | 770 | [data-dir] |
251 | 753 | path= foo bins | 771 | path= foo bins |
252 | @@ -2194,17 +2212,21 @@ | |||
253 | 2194 | 2212 | ||
254 | 2195 | >>> print system(buildout+' -vv'), # doctest: +NORMALIZE_WHITESPACE | 2213 | >>> print system(buildout+' -vv'), # doctest: +NORMALIZE_WHITESPACE |
255 | 2196 | Installing 'zc.buildout', 'setuptools'. | 2214 | Installing 'zc.buildout', 'setuptools'. |
257 | 2197 | We have a develop egg: zc.buildout 1.0.0. | 2215 | We have a develop egg: zc.buildout X.X. |
258 | 2198 | We have the best distribution that satisfies 'setuptools'. | 2216 | We have the best distribution that satisfies 'setuptools'. |
260 | 2199 | Picked: setuptools = 0.6 | 2217 | Picked: setuptools = V.V |
261 | 2200 | <BLANKLINE> | 2218 | <BLANKLINE> |
262 | 2201 | Configuration data: | 2219 | Configuration data: |
263 | 2202 | [buildout] | 2220 | [buildout] |
264 | 2221 | allow-hosts = * | ||
265 | 2222 | allow-picked-versions = true | ||
266 | 2203 | bin-directory = /sample-buildout/bin | 2223 | bin-directory = /sample-buildout/bin |
267 | 2204 | develop-eggs-directory = /sample-buildout/develop-eggs | 2224 | develop-eggs-directory = /sample-buildout/develop-eggs |
268 | 2205 | directory = /sample-buildout | 2225 | directory = /sample-buildout |
269 | 2206 | eggs-directory = /sample-buildout/eggs | 2226 | eggs-directory = /sample-buildout/eggs |
271 | 2207 | executable = /usr/local/bin/python2.3 | 2227 | executable = python |
272 | 2228 | find-links = | ||
273 | 2229 | install-from-cache = false | ||
274 | 2208 | installed = /sample-buildout/.installed.cfg | 2230 | installed = /sample-buildout/.installed.cfg |
275 | 2209 | log-format = | 2231 | log-format = |
276 | 2210 | log-level = INFO | 2232 | log-level = INFO |
277 | @@ -2212,7 +2234,10 @@ | |||
278 | 2212 | offline = false | 2234 | offline = false |
279 | 2213 | parts = | 2235 | parts = |
280 | 2214 | parts-directory = /sample-buildout/parts | 2236 | parts-directory = /sample-buildout/parts |
281 | 2237 | prefer-final = false | ||
282 | 2215 | python = buildout | 2238 | python = buildout |
283 | 2239 | unzip = false | ||
284 | 2240 | use-dependency-links = true | ||
285 | 2216 | verbosity = 20 | 2241 | verbosity = 20 |
286 | 2217 | <BLANKLINE> | 2242 | <BLANKLINE> |
287 | 2218 | 2243 | ||
288 | @@ -2220,6 +2245,37 @@ | |||
289 | 2220 | command-line assignments. We've discussed most of these options | 2245 | command-line assignments. We've discussed most of these options |
290 | 2221 | already, but let's review them and touch on some we haven't discussed: | 2246 | already, but let's review them and touch on some we haven't discussed: |
291 | 2222 | 2247 | ||
292 | 2248 | allow-hosts | ||
293 | 2249 | On some environments the links visited by `zc.buildout` can be forbidden by | ||
294 | 2250 | paranoid firewalls. These URLs might be in the chain of links visited by | ||
295 | 2251 | `zc.buildout` as defined by buildout's `find-links` option, or as defined | ||
296 | 2252 | by various eggs in their `url`, `download_url`, `dependency_links` metadata. | ||
297 | 2253 | |||
298 | 2254 | The fact that package_index works like a spider and might visit links and | ||
299 | 2255 | go to other locations makes this even harder. | ||
300 | 2256 | |||
301 | 2257 | The `allow-hosts` option provides a way to prevent this, and | ||
302 | 2258 | works exactly like the one provided in `easy_install`. | ||
303 | 2259 | |||
304 | 2260 | You can provide a list of allowed host, together with wildcards:: | ||
305 | 2261 | |||
306 | 2262 | [buildout] | ||
307 | 2263 | ... | ||
308 | 2264 | |||
309 | 2265 | allow-hosts = | ||
310 | 2266 | *.python.org | ||
311 | 2267 | example.com | ||
312 | 2268 | |||
313 | 2269 | All URLs that does not match these hosts will not be visited. | ||
314 | 2270 | |||
315 | 2271 | allow-picked-versions | ||
316 | 2272 | By default, the buildout will choose the best match for a given requirement | ||
317 | 2273 | if the requirement is not specified precisely (for instance, using the | ||
318 | 2274 | "versions" option. This behavior corresponds to the | ||
319 | 2275 | "allow-picked-versions" being set to its default value, "true". If | ||
320 | 2276 | "allow-picked-versions" is "false," instead of picking the best match, | ||
321 | 2277 | buildout will raise an error. This helps enforce repeatability. | ||
322 | 2278 | |||
323 | 2223 | bin-directory | 2279 | bin-directory |
324 | 2224 | The directory path where scripts are written. This can be a | 2280 | The directory path where scripts are written. This can be a |
325 | 2225 | relative path, which is interpreted relative to the directory | 2281 | relative path, which is interpreted relative to the directory |
326 | @@ -2244,6 +2300,47 @@ | |||
327 | 2244 | The Python executable used to run the buildout. See the python | 2300 | The Python executable used to run the buildout. See the python |
328 | 2245 | option below. | 2301 | option below. |
329 | 2246 | 2302 | ||
330 | 2303 | find-links | ||
331 | 2304 | You can specify more locations to search for distributions using the | ||
332 | 2305 | `find-links` option. All locations specified will be searched for | ||
333 | 2306 | distributions along with the package index as described before. | ||
334 | 2307 | |||
335 | 2308 | Locations can be urls:: | ||
336 | 2309 | |||
337 | 2310 | [buildout] | ||
338 | 2311 | ... | ||
339 | 2312 | find-links = http://download.zope.org/distribution/ | ||
340 | 2313 | |||
341 | 2314 | They can also be directories on disk:: | ||
342 | 2315 | |||
343 | 2316 | [buildout] | ||
344 | 2317 | ... | ||
345 | 2318 | find-links = /some/path | ||
346 | 2319 | |||
347 | 2320 | Finally, they can also be direct paths to distributions:: | ||
348 | 2321 | |||
349 | 2322 | [buildout] | ||
350 | 2323 | ... | ||
351 | 2324 | find-links = /some/path/someegg-1.0.0-py2.3.egg | ||
352 | 2325 | |||
353 | 2326 | Any number of locations can be specified in the `find-links` option:: | ||
354 | 2327 | |||
355 | 2328 | [buildout] | ||
356 | 2329 | ... | ||
357 | 2330 | find-links = | ||
358 | 2331 | http://download.zope.org/distribution/ | ||
359 | 2332 | /some/otherpath | ||
360 | 2333 | /some/path/someegg-1.0.0-py2.3.egg | ||
361 | 2334 | |||
362 | 2335 | install-from-cache | ||
363 | 2336 | A download cache can be used as the basis of application source releases. | ||
364 | 2337 | In an application source release, we want to distribute an application that | ||
365 | 2338 | can be built without making any network accesses. In this case, we | ||
366 | 2339 | distribute a buildout with download cache and tell the buildout to install | ||
367 | 2340 | from the download cache only, without making network accesses. The | ||
368 | 2341 | buildout install-from-cache option can be used to signal that packages | ||
369 | 2342 | should be installed only from the download cache. | ||
370 | 2343 | |||
371 | 2247 | installed | 2344 | installed |
372 | 2248 | The file path where information about the results of the previous | 2345 | The file path where information about the results of the previous |
373 | 2249 | buildout run is written. This can be a relative path, which is | 2346 | buildout run is written. This can be a relative path, which is |
374 | @@ -2257,12 +2354,51 @@ | |||
375 | 2257 | log-level | 2354 | log-level |
376 | 2258 | The log level before verbosity adjustment | 2355 | The log level before verbosity adjustment |
377 | 2259 | 2356 | ||
378 | 2357 | newest | ||
379 | 2358 | By default buildout and recipes will try to find the newest versions of | ||
380 | 2359 | distributions needed to satisfy requirements. This can be very time | ||
381 | 2360 | consuming, especially when incrementally working on setting up a buildout | ||
382 | 2361 | or working on a recipe. The buildout "newest" option can be used to to | ||
383 | 2362 | suppress this. If the "newest" option is set to false, then new | ||
384 | 2363 | distributions won't be sought if an installed distribution meets | ||
385 | 2364 | requirements. The "newest" option can also be set to false using the -N | ||
386 | 2365 | command-line option. See also the "offline" option. | ||
387 | 2366 | |||
388 | 2367 | offline | ||
389 | 2368 | The "offline" option goes a bit further than the "newest" option. If the | ||
390 | 2369 | buildout "offline" option is given a value of "true", the buildout and | ||
391 | 2370 | recipes that are aware of the option will avoid doing network access. This | ||
392 | 2371 | is handy when running the buildout when not connected to the internet. It | ||
393 | 2372 | also makes buildouts run much faster. This option is typically set using | ||
394 | 2373 | the buildout -o option. | ||
395 | 2374 | |||
396 | 2260 | parts | 2375 | parts |
397 | 2261 | A white space separated list of parts to be installed. | 2376 | A white space separated list of parts to be installed. |
398 | 2262 | 2377 | ||
399 | 2263 | parts-directory | 2378 | parts-directory |
400 | 2264 | A working directory that parts can used to store data. | 2379 | A working directory that parts can used to store data. |
401 | 2265 | 2380 | ||
402 | 2381 | prefer-final | ||
403 | 2382 | Currently, when searching for new releases, the newest available | ||
404 | 2383 | release is used. This isn't usually ideal, as you may get a | ||
405 | 2384 | development release or alpha releases not ready to be widely used. | ||
406 | 2385 | You can request that final releases be preferred using the prefer | ||
407 | 2386 | final option in the buildout section:: | ||
408 | 2387 | |||
409 | 2388 | [buildout] | ||
410 | 2389 | ... | ||
411 | 2390 | prefer-final = true | ||
412 | 2391 | |||
413 | 2392 | When the prefer-final option is set to true, then when searching for | ||
414 | 2393 | new releases, final releases are preferred. If there are final | ||
415 | 2394 | releases that satisfy distribution requirements, then those releases | ||
416 | 2395 | are used even if newer non-final releases are available. The buildout | ||
417 | 2396 | prefer-final option can be used to override this behavior. | ||
418 | 2397 | |||
419 | 2398 | In buildout version 2, final releases will be preferred by default. | ||
420 | 2399 | You will then need to use a false value for prefer-final to get the | ||
421 | 2400 | newest releases. | ||
422 | 2401 | |||
423 | 2266 | python | 2402 | python |
424 | 2267 | The name of a section containing information about the default | 2403 | The name of a section containing information about the default |
425 | 2268 | Python interpreter. Recipes that need a installation | 2404 | Python interpreter. Recipes that need a installation |
426 | @@ -2273,6 +2409,26 @@ | |||
427 | 2273 | Python executable. By default, the buildout section defines the | 2409 | Python executable. By default, the buildout section defines the |
428 | 2274 | default Python as the Python used to run the buildout. | 2410 | default Python as the Python used to run the buildout. |
429 | 2275 | 2411 | ||
430 | 2412 | unzip | ||
431 | 2413 | By default, zc.buildout doesn't unzip zip-safe eggs ("unzip = false"). | ||
432 | 2414 | This follows the policy followed by setuptools itself. Experience shows | ||
433 | 2415 | this policy to to be inconvenient. Zipped eggs make debugging more | ||
434 | 2416 | difficult and often import more slowly. You can include an unzip option in | ||
435 | 2417 | the buildout section to change the default unzipping policy ("unzip = | ||
436 | 2418 | true"). | ||
437 | 2419 | |||
438 | 2420 | use-dependency-links | ||
439 | 2421 | By default buildout will obey the setuptools dependency_links metadata | ||
440 | 2422 | when it looks for dependencies. This behavior can be controlled with | ||
441 | 2423 | the use-dependency-links buildout option:: | ||
442 | 2424 | |||
443 | 2425 | [buildout] | ||
444 | 2426 | ... | ||
445 | 2427 | use-dependency-links = false | ||
446 | 2428 | |||
447 | 2429 | The option defaults to true. If you set it to false, then dependency | ||
448 | 2430 | links are only looked for in the locations specified by find-links. | ||
449 | 2431 | |||
450 | 2276 | verbosity | 2432 | verbosity |
451 | 2277 | A log-level adjustment. Typically, this is set via the -q and -v | 2433 | A log-level adjustment. Typically, this is set via the -q and -v |
452 | 2278 | command-line options. | 2434 | command-line options. |
453 | @@ -2351,48 +2507,6 @@ | |||
454 | 2351 | Generated script '/sample-bootstrapped2/bin/buildout'. | 2507 | Generated script '/sample-bootstrapped2/bin/buildout'. |
455 | 2352 | 2508 | ||
456 | 2353 | 2509 | ||
457 | 2354 | Newest and Offline Modes | ||
458 | 2355 | ------------------------ | ||
459 | 2356 | |||
460 | 2357 | By default buildout and recipes will try to find the newest versions | ||
461 | 2358 | of distributions needed to satisfy requirements. This can be very | ||
462 | 2359 | time consuming, especially when incrementally working on setting up a | ||
463 | 2360 | buildout or working on a recipe. The buildout newest option can be | ||
464 | 2361 | used to to suppress this. If the newest option is set to false, then | ||
465 | 2362 | new distributions won't be sought if an installed distribution meets | ||
466 | 2363 | requirements. The newest option can be set to false using the -N | ||
467 | 2364 | command-line option. | ||
468 | 2365 | |||
469 | 2366 | The offline option goes a bit further. If the buildout offline option | ||
470 | 2367 | is given a value of "true", the buildout and recipes that are aware of | ||
471 | 2368 | the option will avoid doing network access. This is handy when | ||
472 | 2369 | running the buildout when not connected to the internet. It also | ||
473 | 2370 | makes buildouts run much faster. This option is typically set using | ||
474 | 2371 | the buildout -o option. | ||
475 | 2372 | |||
476 | 2373 | Preferring Final Releases | ||
477 | 2374 | ------------------------- | ||
478 | 2375 | |||
479 | 2376 | Currently, when searching for new releases, the newest available | ||
480 | 2377 | release is used. This isn't usually ideal, as you may get a | ||
481 | 2378 | development release or alpha releases not ready to be widely used. | ||
482 | 2379 | You can request that final releases be preferred using the prefer | ||
483 | 2380 | final option in the buildout section:: | ||
484 | 2381 | |||
485 | 2382 | [buildout] | ||
486 | 2383 | ... | ||
487 | 2384 | prefer-final = true | ||
488 | 2385 | |||
489 | 2386 | When the prefer-final option is set to true, then when searching for | ||
490 | 2387 | new releases, final releases are preferred. If there are final | ||
491 | 2388 | releases that satisfy distribution requirements, then those releases | ||
492 | 2389 | are used even if newer non-final releases are available. The buildout | ||
493 | 2390 | prefer-final option can be used to override this behavior. | ||
494 | 2391 | |||
495 | 2392 | In buildout version 2, final releases will be preferred by default. | ||
496 | 2393 | You will then need to use a false value for prefer-final to get the | ||
497 | 2394 | newest releases. | ||
498 | 2395 | |||
499 | 2396 | Finding distributions | 2510 | Finding distributions |
500 | 2397 | --------------------- | 2511 | --------------------- |
501 | 2398 | 2512 | ||
502 | @@ -2411,49 +2525,7 @@ | |||
503 | 2411 | requirements of the buildout will always be used. | 2525 | requirements of the buildout will always be used. |
504 | 2412 | 2526 | ||
505 | 2413 | You can also specify more locations to search for distributions using | 2527 | You can also specify more locations to search for distributions using |
549 | 2414 | the `find-links` option. All locations specified will be searched for | 2528 | the `find-links` option. See its description above. |
507 | 2415 | distributions along with the package index as described before. | ||
508 | 2416 | |||
509 | 2417 | Locations can be urls:: | ||
510 | 2418 | |||
511 | 2419 | [buildout] | ||
512 | 2420 | ... | ||
513 | 2421 | find-links = http://download.zope.org/distribution/ | ||
514 | 2422 | |||
515 | 2423 | They can also be directories on disk:: | ||
516 | 2424 | |||
517 | 2425 | [buildout] | ||
518 | 2426 | ... | ||
519 | 2427 | find-links = /some/path | ||
520 | 2428 | |||
521 | 2429 | Finally, they can also be direct paths to distributions:: | ||
522 | 2430 | |||
523 | 2431 | [buildout] | ||
524 | 2432 | ... | ||
525 | 2433 | find-links = /some/path/someegg-1.0.0-py2.3.egg | ||
526 | 2434 | |||
527 | 2435 | Any number of locations can be specified in the `find-links` option:: | ||
528 | 2436 | |||
529 | 2437 | [buildout] | ||
530 | 2438 | ... | ||
531 | 2439 | find-links = | ||
532 | 2440 | http://download.zope.org/distribution/ | ||
533 | 2441 | /some/otherpath | ||
534 | 2442 | /some/path/someegg-1.0.0-py2.3.egg | ||
535 | 2443 | |||
536 | 2444 | Dependency links | ||
537 | 2445 | ---------------- | ||
538 | 2446 | |||
539 | 2447 | By default buildout will obey the setuptools dependency_links metadata | ||
540 | 2448 | when it looks for dependencies. This behavior can be controlled with | ||
541 | 2449 | the use-dependency-links buildout option:: | ||
542 | 2450 | |||
543 | 2451 | [buildout] | ||
544 | 2452 | ... | ||
545 | 2453 | use-dependency-links = false | ||
546 | 2454 | |||
547 | 2455 | The option defaults to true. If you set it to false, then dependency | ||
548 | 2456 | links are only looked for in the locations specified by find-links. | ||
550 | 2457 | 2529 | ||
551 | 2458 | Controlling the installation database | 2530 | Controlling the installation database |
552 | 2459 | ------------------------------------- | 2531 | ------------------------------------- |
553 | @@ -2615,37 +2687,11 @@ | |||
554 | 2615 | Develop: '/sample-bootstrapped/demo' | 2687 | Develop: '/sample-bootstrapped/demo' |
555 | 2616 | unload ['buildout'] | 2688 | unload ['buildout'] |
556 | 2617 | 2689 | ||
557 | 2618 | Allow hosts | ||
558 | 2619 | ----------- | ||
559 | 2620 | |||
560 | 2621 | On some environments the links visited by `zc.buildout` can be forbidden | ||
561 | 2622 | by paranoiac firewalls. These URL might be on the chain of links | ||
562 | 2623 | visited by `zc.buildout` wheter they are defined in the `find-links` option, | ||
563 | 2624 | wheter they are defined by various eggs in their `url`, `download_url`, | ||
564 | 2625 | `dependency_links` metadata. | ||
565 | 2626 | |||
566 | 2627 | It is even harder to track that package_index works like a spider and | ||
567 | 2628 | might visit links and go to other location. | ||
568 | 2629 | |||
569 | 2630 | The `allow-hosts` option provides a way to prevent this, and | ||
570 | 2631 | works exactly like the one provided in `easy_install`. | ||
571 | 2632 | |||
572 | 2633 | You can provide a list of allowed host, together with wildcards:: | ||
573 | 2634 | |||
574 | 2635 | [buildout] | ||
575 | 2636 | ... | ||
576 | 2637 | |||
577 | 2638 | allow-hosts = | ||
578 | 2639 | *.python.org | ||
579 | 2640 | example.com | ||
580 | 2641 | |||
581 | 2642 | All urls that does not match these hosts will not be visited. | ||
582 | 2643 | |||
583 | 2644 | .. [#future_recipe_methods] In the future, additional methods may be | 2690 | .. [#future_recipe_methods] In the future, additional methods may be |
584 | 2645 | added. Older recipes with fewer methods will still be | 2691 | added. Older recipes with fewer methods will still be |
585 | 2646 | supported. | 2692 | supported. |
586 | 2647 | 2693 | ||
587 | 2648 | .. [#packaging_info] If we wanted to create a distribution from this | 2694 | .. [#packaging_info] If we wanted to create a distribution from this |
589 | 2649 | package, we would need specify much more information. See the | 2695 | package, we would need to specify much more information. See the |
590 | 2650 | `setuptools documentation | 2696 | `setuptools documentation |
591 | 2651 | <http://peak.telecommunity.com/DevCenter/setuptools>`_. | 2697 | <http://peak.telecommunity.com/DevCenter/setuptools>`_. |
592 | 2652 | 2698 | ||
593 | === modified file 'src/zc/buildout/tests.py' | |||
594 | --- src/zc/buildout/tests.py 2010-02-17 21:27:15 +0000 | |||
595 | +++ src/zc/buildout/tests.py 2010-02-17 21:27:15 +0000 | |||
596 | @@ -2981,6 +2981,9 @@ | |||
597 | 2981 | '-q develop -mxN -d /sample-buildout/develop-eggs' | 2981 | '-q develop -mxN -d /sample-buildout/develop-eggs' |
598 | 2982 | ), | 2982 | ), |
599 | 2983 | (re.compile(r'^[*]...'), '...'), | 2983 | (re.compile(r'^[*]...'), '...'), |
600 | 2984 | # for bug_92891_bootstrap_crashes_with_egg_recipe_in_buildout_section | ||
601 | 2985 | (re.compile(r"Unused options for buildout: 'eggs' 'scripts'\."), | ||
602 | 2986 | "Unused options for buildout: 'scripts' 'eggs'."), | ||
603 | 2984 | ]), | 2987 | ]), |
604 | 2985 | ), | 2988 | ), |
605 | 2986 | zc.buildout.testselectingpython.test_suite(), | 2989 | zc.buildout.testselectingpython.test_suite(), |
606 | 2987 | 2990 | ||
607 | === modified file 'zc.recipe.egg_/src/zc/recipe/egg/egg.py' | |||
608 | --- zc.recipe.egg_/src/zc/recipe/egg/egg.py 2009-11-06 22:33:23 +0000 | |||
609 | +++ zc.recipe.egg_/src/zc/recipe/egg/egg.py 2010-02-17 21:27:15 +0000 | |||
610 | @@ -25,8 +25,8 @@ | |||
611 | 25 | self.buildout = buildout | 25 | self.buildout = buildout |
612 | 26 | self.name = name | 26 | self.name = name |
613 | 27 | self.options = options | 27 | self.options = options |
616 | 28 | links = options.get('find-links', | 28 | b_options = buildout['buildout'] |
617 | 29 | buildout['buildout'].get('find-links')) | 29 | links = options.get('find-links', b_options['find-links']) |
618 | 30 | if links: | 30 | if links: |
619 | 31 | links = links.split() | 31 | links = links.split() |
620 | 32 | options['find-links'] = '\n'.join(links) | 32 | options['find-links'] = '\n'.join(links) |
621 | @@ -34,25 +34,25 @@ | |||
622 | 34 | links = () | 34 | links = () |
623 | 35 | self.links = links | 35 | self.links = links |
624 | 36 | 36 | ||
626 | 37 | index = options.get('index', buildout['buildout'].get('index')) | 37 | index = options.get('index', b_options.get('index')) |
627 | 38 | if index is not None: | 38 | if index is not None: |
628 | 39 | options['index'] = index | 39 | options['index'] = index |
629 | 40 | self.index = index | 40 | self.index = index |
630 | 41 | 41 | ||
632 | 42 | allow_hosts = buildout['buildout'].get('allow-hosts', '*') | 42 | allow_hosts = b_options['allow-hosts'] |
633 | 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') |
634 | 44 | if host.strip()!='']) | 44 | if host.strip()!='']) |
635 | 45 | self.allow_hosts = allow_hosts | 45 | self.allow_hosts = allow_hosts |
636 | 46 | 46 | ||
638 | 47 | options['eggs-directory'] = buildout['buildout']['eggs-directory'] | 47 | options['eggs-directory'] = b_options['eggs-directory'] |
639 | 48 | options['_e'] = options['eggs-directory'] # backward compat. | 48 | options['_e'] = options['eggs-directory'] # backward compat. |
642 | 49 | options['develop-eggs-directory' | 49 | options['develop-eggs-directory'] = b_options['develop-eggs-directory'] |
641 | 50 | ] = buildout['buildout']['develop-eggs-directory'] | ||
643 | 51 | options['_d'] = options['develop-eggs-directory'] # backward compat. | 50 | options['_d'] = options['develop-eggs-directory'] # backward compat. |
644 | 52 | 51 | ||
646 | 53 | assert options.get('unzip') in ('true', 'false', None) | 52 | # verify that this is None, 'true' or 'false' |
647 | 53 | get_bool(options, 'unzip') | ||
648 | 54 | 54 | ||
650 | 55 | python = options.get('python', buildout['buildout']['python']) | 55 | python = options.get('python', b_options['python']) |
651 | 56 | options['executable'] = buildout[python]['executable'] | 56 | options['executable'] = buildout[python]['executable'] |
652 | 57 | 57 | ||
653 | 58 | def working_set(self, extra=()): | 58 | def working_set(self, extra=()): |
654 | @@ -61,6 +61,7 @@ | |||
655 | 61 | This is intended for reuse by similar recipes. | 61 | This is intended for reuse by similar recipes. |
656 | 62 | """ | 62 | """ |
657 | 63 | options = self.options | 63 | options = self.options |
658 | 64 | b_options = self.buildout['buildout'] | ||
659 | 64 | 65 | ||
660 | 65 | distributions = [ | 66 | distributions = [ |
661 | 66 | r.strip() | 67 | r.strip() |
662 | @@ -76,9 +77,8 @@ | |||
663 | 76 | ) | 77 | ) |
664 | 77 | else: | 78 | else: |
665 | 78 | kw = {} | 79 | kw = {} |
667 | 79 | if options.get('unzip'): | 80 | if 'unzip' in options: |
668 | 80 | kw['always_unzip'] = get_bool(options, 'unzip') | 81 | kw['always_unzip'] = get_bool(options, 'unzip') |
669 | 81 | |||
670 | 82 | ws = zc.buildout.easy_install.install( | 82 | ws = zc.buildout.easy_install.install( |
671 | 83 | distributions, options['eggs-directory'], | 83 | distributions, options['eggs-directory'], |
672 | 84 | links=self.links, | 84 | links=self.links, |
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.