Commit 53d91da4 authored by gotcha's avatar gotcha

Warning for wrong script name

Warning when a script name passed in 'scripts' argument of easy_install.scripts
is not defined in an entry point.

git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@110953 62d5b8a3-27da-0310-9561-8e5933582275
parent b0b01710
...@@ -6,8 +6,11 @@ Change History ...@@ -6,8 +6,11 @@ Change History
New feature: New feature:
- Warn when a script name passed in 'scripts' argument of easy_install.scripts
is not defined in an entry point.
- Added buildout:socket-timout option so that socket timeout can be configured - Added buildout:socket-timout option so that socket timeout can be configured
both from command line and from config files. (gotcha) both from command line and from config files.
1.4.3 (2009-12-10) 1.4.3 (2009-12-10)
================== ==================
......
...@@ -940,7 +940,10 @@ def scripts(reqs, working_set, executable, dest, ...@@ -940,7 +940,10 @@ def scripts(reqs, working_set, executable, dest,
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:
...@@ -956,6 +959,18 @@ def scripts(reqs, working_set, executable, dest, ...@@ -956,6 +959,18 @@ def scripts(reqs, working_set, executable, dest,
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 target egg.", name)
else:
logger.warning("Could not generate script '%s' as script "
"'%s' is not defined in the target egg.", name, target)
if interpreter: if interpreter:
sname = os.path.join(dest, interpreter) sname = os.path.join(dest, interpreter)
spath, rpsetup = _relative_path_and_setup(sname, path, relative_paths) spath, rpsetup = _relative_path_and_setup(sname, path, relative_paths)
...@@ -1252,4 +1267,3 @@ def redo_pyc(egg): ...@@ -1252,4 +1267,3 @@ def redo_pyc(egg):
subprocess.call([sys.executable, args]) subprocess.call([sys.executable, args])
else: else:
os.spawnv(os.P_WAIT, sys.executable, args) os.spawnv(os.P_WAIT, sys.executable, args)
...@@ -344,6 +344,48 @@ You can also control the name used for scripts: ...@@ -344,6 +344,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 target egg.
>>> 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 target egg.
>>> 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