Commit 9d63021a authored by Godefroid Chapelle's avatar Godefroid Chapelle

Problem: error message is not explicit

Solution: expand it to sthing more detailed
parent c7e22a45
Improve error message when a package version is not pinned and `allow-picked-versions = false`.
......@@ -635,10 +635,11 @@ class Installer(object):
self._picked_versions[dist.project_name] = dist.version
if not self._allow_picked_versions:
raise zc.buildout.UserError(
'Picked: %s = %s' % (dist.project_name,
dist.version)
msg = NOT_PICKED_AND_NOT_ALLOWED.format(
name=dist.project_name,
version=dist.version
)
raise zc.buildout.UserError(msg)
def _maybe_add_setuptools(self, ws, dist):
if dist_needs_pkg_resources(dist):
......@@ -1949,3 +1950,17 @@ def sort_working_set(ws, eggs_dir, develop_eggs_dir):
sorted_paths.extend(egg_paths)
sorted_paths.extend(other_paths)
return pkg_resources.WorkingSet(sorted_paths)
NOT_PICKED_AND_NOT_ALLOWED = """\
Picked: {name} = {version}
The `{name}` egg does not have a version pin and `allow-picked-versions = false`.
To resolve this, add
{name} = {version}
to the [versions] section,
OR set `allow-picked-versions = true`."""
......@@ -383,6 +383,16 @@ We can request that we get an error if versions are picked:
Traceback (most recent call last):
...
UserError: Picked: demo = 0.3
<BLANKLINE>
The `demo` egg does not have a version pin and `allow-picked-versions = false`.
<BLANKLINE>
To resolve this, add
<BLANKLINE>
demo = 0.3
<BLANKLINE>
to the [versions] section,
<BLANKLINE>
OR set `allow-picked-versions = true`.
>>> zc.buildout.easy_install.allow_picked_versions(True)
False
......
......@@ -209,6 +209,7 @@ versions:
Installing recipe spam.
Getting distribution for 'spam'.
Error: Picked: spam = 2
...
We can name a version something else, if we wish, using the versions option:
......
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