Commit b2500b00 authored by Jason Madden's avatar Jason Madden

Add a zc.recipe.egg test case.

parent 9521ac53
======================
Allow Unknown Extras
======================
Sometimes we need to allow unknown extras.
The ``allow-unknown-extras`` option lets us do that in a buildout
configuration, just as we can directly calling ``easy_install``
works exactly like the one provided in ``easy_install``.
Let's create a develop egg that requires a bogus extra.
>>> mkdir(sample_buildout, 'allowdemo')
>>> write(sample_buildout, 'allowdemo', 'dependencydemo.py',
... 'import eggrecipekss.core')
>>> write(sample_buildout, 'allowdemo', 'setup.py',
... '''from setuptools import setup; setup(
... name='allowdemo', py_modules=['dependencydemo'],
... zip_safe=True, version='1')
... ''')
Now let's configure the buildout to use the develop egg with a bogus extra.
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
... develop = allowdemo
... parts = eggs
...
... [eggs]
... recipe = zc.recipe.egg:eggs
... eggs = allowdemo[bad_extra]
... ''')
Now we can run the buildout and see that it fails:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/allowdemo'
Installing eggs...
...
While:
Installing eggs.
Error: Couldn't find the required extras. Add 'allow-unknown-extras=true' to the [buildout] configuration if this is acceptable.
If we flip the option on, the buildout succeeds
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
... develop = allowdemo
... parts = eggs
... allow-unknown-extras = true
...
... [eggs]
... recipe = zc.recipe.egg:eggs
... eggs = allowdemo[bad_extra]
... ''')
Now we can run the buildout and make sure all attempts to dist.plone.org fails::
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/allowdemo'
Installing eggs...
allowdemo 1 does not provide the extra 'bad_extra'
...@@ -3712,7 +3712,7 @@ def test_suite(): ...@@ -3712,7 +3712,7 @@ def test_suite():
doctest.DocFileSuite( doctest.DocFileSuite(
'easy_install.txt', 'downloadcache.txt', 'dependencylinks.txt', 'easy_install.txt', 'downloadcache.txt', 'dependencylinks.txt',
'allowhosts.txt', 'allowhosts.txt', 'allow-unknown-extras.txt',
setUp=easy_install_SetUp, setUp=easy_install_SetUp,
tearDown=zc.buildout.testing.buildoutTearDown, tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS, optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
......
...@@ -84,7 +84,7 @@ class Eggs(object): ...@@ -84,7 +84,7 @@ class Eggs(object):
links=self.links, links=self.links,
index=self.index, index=self.index,
allow_hosts=self.allow_hosts, allow_hosts=self.allow_hosts,
allow_unknown_extras=bool_option(buildout['buildout'], 'allow-unknown-extras') allow_unknown_extras=bool_option(buildout_section, 'allow-unknown-extras')
) )
return orig_distributions, ws return orig_distributions, ws
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment