Commit f5eec302 authored by Godefroid Chapelle's avatar Godefroid Chapelle

Problem: Does not complain for typo in 'scripts'

Solution: Warn when a script name passed in 'scripts' argument of easy_install.scripts
is not defined in egg entry points.
parent 202f679a
...@@ -4,6 +4,9 @@ Change History ...@@ -4,6 +4,9 @@ Change History
3.0.0a2 (unreleased) 3.0.0a2 (unreleased)
==================== ====================
- Warn when a script name passed in 'scripts' argument of easy_install.scripts
is not defined in egg entry points.
- Show only once pip warning about python version. - Show only once pip warning about python version.
- Better patch for ``pkg_resources.Distribution.hashcmp`` performance. - Better patch for ``pkg_resources.Distribution.hashcmp`` performance.
......
...@@ -1203,7 +1203,10 @@ def scripts(reqs, working_set, executable, dest=None, ...@@ -1203,7 +1203,10 @@ def scripts(reqs, working_set, executable, dest=None,
else: else:
entry_points.append(req) entry_points.append(req)
entry_points_names = []
for name, module_name, attrs in entry_points: for name, module_name, attrs in entry_points:
entry_points_names.append(name)
if scripts is not None: if scripts is not None:
sname = scripts.get(name) sname = scripts.get(name)
if sname is None: if sname is None:
...@@ -1219,6 +1222,18 @@ def scripts(reqs, working_set, executable, dest=None, ...@@ -1219,6 +1222,18 @@ def scripts(reqs, working_set, executable, dest=None,
initialization, rpsetup) initialization, rpsetup)
) )
# warn when a script name passed in 'scripts' argument
# is not defined in an entry point.
if scripts is not None:
for name, target in scripts.items():
if name not in entry_points_names:
if name == target:
logger.warning("Could not generate script '%s' as it is not "
"defined in the egg entry points.", name)
else:
logger.warning("Could not generate script '%s' as script "
"'%s' is not defined in the egg entry points.", name, target)
for name, contents in distutils_scripts: for name, contents in distutils_scripts:
if scripts is not None: if scripts is not None:
sname = scripts.get(name) sname = scripts.get(name)
......
...@@ -346,6 +346,48 @@ You can also control the name used for scripts: ...@@ -346,6 +346,48 @@ You can also control the name used for scripts:
- buildout - buildout
- foo - foo
If a wrong script name is provided, buildout tells about it:
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = demo
...
... [demo]
... recipe = zc.recipe.egg
... find-links = %(server)s
... index = %(server)s/index
... scripts = undefined
... """ % dict(server=link_server))
>>> print system(buildout),
Uninstalling demo.
Installing demo.
Could not generate script 'undefined' as it is not defined in the egg entry points.
>>> ls(sample_buildout, 'bin')
- buildout
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = demo
...
... [demo]
... recipe = zc.recipe.egg
... find-links = %(server)s
... index = %(server)s/index
... scripts = foo=undefined
... """ % dict(server=link_server))
>>> print system(buildout),
Uninstalling demo.
Installing demo.
Could not generate script 'foo' as script 'undefined' is not defined in the egg entry points.
>>> ls(sample_buildout, 'bin')
- buildout
Specifying extra script paths Specifying extra script paths
----------------------------- -----------------------------
......
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