[Checkins] SVN: zc.buildout/trunk/z3c.recipe.scripts_/ fix two bugs in z3c.recipe.scripts
Gary Poster
gary.poster at canonical.com
Fri Aug 27 22:13:27 EDT 2010
Log message for revision 115974:
fix two bugs in z3c.recipe.scripts
Changed:
U zc.buildout/trunk/z3c.recipe.scripts_/CHANGES.txt
U zc.buildout/trunk/z3c.recipe.scripts_/src/z3c/recipe/scripts/README.txt
U zc.buildout/trunk/z3c.recipe.scripts_/src/z3c/recipe/scripts/scripts.py
-=-
Modified: zc.buildout/trunk/z3c.recipe.scripts_/CHANGES.txt
===================================================================
--- zc.buildout/trunk/z3c.recipe.scripts_/CHANGES.txt 2010-08-27 20:54:35 UTC (rev 115973)
+++ zc.buildout/trunk/z3c.recipe.scripts_/CHANGES.txt 2010-08-28 02:13:25 UTC (rev 115974)
@@ -4,8 +4,14 @@
1.0.1 (unreleased)
==================
-(no changes so far)
+Fixes
+-----
+- If a section extends another one, it should be able to override it.
+
+- The allowed-eggs-from-site-packages should be looked for in the buildout
+ section if it is not found locally.
+
1.0.0 (2010-08-23)
==================
Modified: zc.buildout/trunk/z3c.recipe.scripts_/src/z3c/recipe/scripts/README.txt
===================================================================
--- zc.buildout/trunk/z3c.recipe.scripts_/src/z3c/recipe/scripts/README.txt 2010-08-27 20:54:35 UTC (rev 115973)
+++ zc.buildout/trunk/z3c.recipe.scripts_/src/z3c/recipe/scripts/README.txt 2010-08-28 02:13:25 UTC (rev 115974)
@@ -325,11 +325,10 @@
... eggs = demoneeded
... ''' % globals())
- >>> print system(buildout)
+ >>> print system(buildout),
Creating directory '/sample-buildout/tmpeggs'.
Uninstalling py.
Installing eggs.
- <BLANKLINE>
That succeeds fine, getting demoneeded from the Python site-packages.
@@ -351,10 +350,11 @@
... [eggs]
... recipe = z3c.recipe.scripts
... include-site-packages = true
+ ... python = primed_python
... allowed-eggs-from-site-packages =
... eggs = demoneeded
... ''' % globals())
- >>> print system(buildout)
+ >>> print system(buildout),
Creating directory '/sample-buildout/tmpeggs'.
Uninstalling eggs.
Installing eggs.
@@ -364,8 +364,71 @@
Installing eggs.
Getting distribution for 'demoneeded'.
Error: Couldn't find a distribution for 'demoneeded'.
- <BLANKLINE>
+The include-sitepackages and allowed-eggs-from-site-packages options both
+can be obtained from the buildout section if they are not set locally.
+
+.. ReST comment: PyPI readers don't need the demonstration, but here it is.
+
+ This succeeds:
+
+ >>> from zc.buildout.tests import create_sample_sys_install
+ >>> create_sample_sys_install(site_packages_path)
+ >>> import zc.buildout.easy_install
+ >>> zc.buildout.easy_install.clear_index_cache()
+
+ >>> write('buildout.cfg',
+ ... '''
+ ... [buildout]
+ ... parts = eggs
+ ... eggs-directory = tmpeggs
+ ... include-site-packages = true
+ ... find-links =
+ ...
+ ... [primed_python]
+ ... executable = %(py_path)s
+ ...
+ ... [eggs]
+ ... recipe = z3c.recipe.scripts
+ ... python = primed_python
+ ... eggs = demoneeded
+ ... ''' % globals())
+
+ >>> print system(buildout),
+ Installing eggs.
+
+ This fails:
+
+ >>> zc.buildout.easy_install.clear_index_cache()
+ >>> rmdir('tmpeggs')
+ >>> write('buildout.cfg',
+ ... '''
+ ... [buildout]
+ ... parts = eggs
+ ... eggs-directory = tmpeggs
+ ... include-site-packages = true
+ ... allowed-eggs-from-site-packages =
+ ... find-links =
+ ...
+ ... [primed_python]
+ ... executable = %(py_path)s
+ ...
+ ... [eggs]
+ ... recipe = z3c.recipe.scripts
+ ... python = primed_python
+ ... eggs = demoneeded
+ ... ''' % globals())
+ >>> print system(buildout),
+ Creating directory '/sample-buildout/tmpeggs'.
+ Uninstalling eggs.
+ Installing eggs.
+ Couldn't find index page for 'demoneeded' (maybe misspelled?)
+ Getting distribution for 'demoneeded'.
+ While:
+ Installing eggs.
+ Getting distribution for 'demoneeded'.
+ Error: Couldn't find a distribution for 'demoneeded'.
+
Remember that you can provide multiple lines to the
allowed-eggs-from-site-packages option, each specifying a whitelist of
allowed packages. Globs (* and ?) are allowed.
@@ -407,6 +470,42 @@
foo bar baz shazam
<BLANKLINE>
+It also will be honored in the buildout section if it is not set locally.
+
+.. ReST comment: PyPI users don't need to see this test. This verifies that
+ exec-sitecustomize is honored if it is in the buildout section.
+
+ >>> write(sample_buildout, 'buildout.cfg',
+ ... """
+ ... [buildout]
+ ... parts = py
+ ... executable = %(py_path)s
+ ... exec-sitecustomize = true
+ ...
+ ... [py]
+ ... recipe = z3c.recipe.scripts:interpreter
+ ... eggs = demo<0.3
+ ... find-links = %(server)s
+ ... index = %(server)s/index
+ ... """ % dict(server=link_server, py_path=py_path))
+
+ >>> print system(buildout),
+ Updating py.
+
+ >>> cat(sample_buildout, 'parts', 'py', 'sitecustomize.py')
+ ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
+ <BLANKLINE>
+ # The following is from
+ # /executable_buildout/parts/py/sitecustomize.py
+ ...
+ import os
+ os.environ['zc.buildout'] = 'foo bar baz shazam'
+
+ >>> print system(join(sample_buildout, 'bin', 'py') +
+ ... ''' -c "import os; print os.environ['zc.buildout']"''')
+ foo bar baz shazam
+ <BLANKLINE>
+
Options
-------
@@ -425,6 +524,9 @@
... eggs = demo<0.3
... find-links = %(server)s
... index = %(server)s/index
+ ... initialization =
+ ... import os
+ ... os.environ['zc.buildout'] = 'sha boo bop bazoodle'
...
... [python]
... recipe = z3c.recipe.scripts:interpreter
Modified: zc.buildout/trunk/z3c.recipe.scripts_/src/z3c/recipe/scripts/scripts.py
===================================================================
--- zc.buildout/trunk/z3c.recipe.scripts_/src/z3c/recipe/scripts/scripts.py 2010-08-27 20:54:35 UTC (rev 115973)
+++ zc.buildout/trunk/z3c.recipe.scripts_/src/z3c/recipe/scripts/scripts.py 2010-08-28 02:13:25 UTC (rev 115974)
@@ -23,7 +23,8 @@
def __init__(self, buildout, name, options):
if 'extends' in options:
- options.update(buildout[options['extends']])
+ for key, value in buildout[options['extends']].items():
+ options.setdefault(key, value)
super(Base, self).__init__(buildout, name, options)
self.default_eggs = '' # Disables feature from zc.recipe.egg.
b_options = buildout['buildout']
@@ -32,7 +33,7 @@
value = options.setdefault(
'allowed-eggs-from-site-packages',
- '*')
+ b_options.get('allowed-eggs-from-site-packages', '*'))
self.allowed_eggs = tuple(name.strip() for name in value.split('\n'))
self.include_site_packages = options.query_bool(
More information about the checkins
mailing list