[Checkins] SVN: zc.buildout/branches/gotcha-scripts-warning/ Warn when a script name passed in 'scripts' argument of easy_install.scripts

Godefroid Chapelle gotcha at bubblenet.be
Fri Apr 16 05:41:48 EDT 2010


Log message for revision 110960:
  Warn when a script name passed in 'scripts' argument of easy_install.scripts
  is not defined in egg entry points.
  

Changed:
  U   zc.buildout/branches/gotcha-scripts-warning/CHANGES.txt
  U   zc.buildout/branches/gotcha-scripts-warning/src/zc/buildout/easy_install.py
  U   zc.buildout/branches/gotcha-scripts-warning/zc.recipe.egg_/src/zc/recipe/egg/README.txt

-=-
Modified: zc.buildout/branches/gotcha-scripts-warning/CHANGES.txt
===================================================================
--- zc.buildout/branches/gotcha-scripts-warning/CHANGES.txt	2010-04-16 09:34:53 UTC (rev 110959)
+++ zc.buildout/branches/gotcha-scripts-warning/CHANGES.txt	2010-04-16 09:41:48 UTC (rev 110960)
@@ -4,7 +4,11 @@
 1.4.4 (?)
 =========
 
+New feature:
 
+- Warn when a script name passed in 'scripts' argument of easy_install.scripts
+  is not defined in egg entry points.
+
 1.4.3 (2009-12-10)
 ==================
 

Modified: zc.buildout/branches/gotcha-scripts-warning/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/gotcha-scripts-warning/src/zc/buildout/easy_install.py	2010-04-16 09:34:53 UTC (rev 110959)
+++ zc.buildout/branches/gotcha-scripts-warning/src/zc/buildout/easy_install.py	2010-04-16 09:41:48 UTC (rev 110960)
@@ -940,7 +940,10 @@
         else:
             entry_points.append(req)
 
+    entry_points_names = []
+
     for name, module_name, attrs in entry_points:
+        entry_points_names.append(name)
         if scripts is not None:
             sname = scripts.get(name)
             if sname is None:
@@ -956,6 +959,18 @@
                     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)
+
     if interpreter:
         sname = os.path.join(dest, interpreter)
         spath, rpsetup = _relative_path_and_setup(sname, path, relative_paths)
@@ -1252,4 +1267,3 @@
                     subprocess.call([sys.executable, args])
                 else:
                     os.spawnv(os.P_WAIT, sys.executable, args)
-

Modified: zc.buildout/branches/gotcha-scripts-warning/zc.recipe.egg_/src/zc/recipe/egg/README.txt
===================================================================
--- zc.buildout/branches/gotcha-scripts-warning/zc.recipe.egg_/src/zc/recipe/egg/README.txt	2010-04-16 09:34:53 UTC (rev 110959)
+++ zc.buildout/branches/gotcha-scripts-warning/zc.recipe.egg_/src/zc/recipe/egg/README.txt	2010-04-16 09:41:48 UTC (rev 110960)
@@ -344,6 +344,48 @@
     -  buildout
     -  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
 -----------------------------
 



More information about the checkins mailing list