Commit 9521ac53 authored by Jason Madden's avatar Jason Madden

Always detect missing extras, and let buildout exit cleanly if we find them.

Also add the required changes to zc.recipe.egg.
parent 5df83961
......@@ -736,20 +736,29 @@ class Installer(object):
pkg_resources.VersionConflict(dist, req), ws)
best[req.key] = dist
if self._allow_unknown_extras:
missing_requested = sorted(
set(req.extras) - set(dist.extras)
missing_requested = sorted(
set(req.extras) - set(dist.extras)
)
for missing in missing_requested:
logger.warning(
'%s does not provide the extra \'%s\'',
dist, missing
)
for missing in missing_requested:
logger.warning(
'%s does not provide the extra \'%s\'',
dist, missing
if missing_requested:
if not self._allow_unknown_extras:
raise zc.buildout.UserError(
"Couldn't find the required extras. Add 'allow-unknown-extras=true' "
"to the [buildout] configuration if this is acceptable."
)
extra_requirements = sorted(
set(dist.extras) & set(req.extras)
)
else:
extra_requirements = dist.requires(req.extras)[::-1]
for extra_requirement in extra_requirements:
self._requirements_and_constraints.append(
"Requirement of %s: %s" % (
......
......@@ -225,7 +225,7 @@ is an error.
... index=link_server+'index/')
Traceback (most recent call last):
...
UnknownExtra: demo 0.3 has no such extra feature 'unknown_extra'
UserError: Couldn't find the required extras. Add 'allow-unknown-extras=true' to the [buildout] configuration if this is acceptable.
We can pass the ``allow_unknown_extras`` argument to force the
installation to proceed.
......
......@@ -3730,9 +3730,7 @@ def test_suite():
(re.compile(r'\\[\\]?'), '/'),
(re.compile('(\n?)- ([a-zA-Z_.-]+)\n- \\2.exe\n'),
'\\1- \\2\n'),
(re.compile(r'^(\w+\.)*(UnknownExtra: )'),
'\2'),
]+(sys.version_info < (2, 5) and [
]+(sys.version_info < (2, 5) and [
(re.compile('.*No module named runpy.*', re.S), ''),
(re.compile('.*usage: pdb.py scriptfile .*', re.S), ''),
(re.compile('.*Error: what does not exist.*', re.S), ''),
......
......@@ -23,6 +23,8 @@ import re
import sys
import zc.buildout.easy_install
from zc.buildout.buildout import bool_option
class Eggs(object):
......@@ -82,6 +84,7 @@ class Eggs(object):
links=self.links,
index=self.index,
allow_hosts=self.allow_hosts,
allow_unknown_extras=bool_option(buildout['buildout'], 'allow-unknown-extras')
)
return orig_distributions, ws
......@@ -127,6 +130,7 @@ class Eggs(object):
links=(),
index=None,
allow_hosts=('*',),
allow_unknown_extras=False,
):
"""Helper function to build a working set.
......@@ -145,6 +149,7 @@ class Eggs(object):
tuple(links),
index,
tuple(allow_hosts),
allow_unknown_extras,
)
if cache_key not in cache_storage:
if offline:
......@@ -159,7 +164,8 @@ class Eggs(object):
index=index,
path=[develop_eggs_dir],
newest=newest,
allow_hosts=allow_hosts)
allow_hosts=allow_hosts,
allow_unknown_extras=allow_unknown_extras)
ws = self._sort_working_set(ws)
cache_storage[cache_key] = 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