[Checkins] SVN: zc.buildout/trunk/ Added the `dependent-scripts` option. When set to `true`, scripts will
Shane Hathaway
shane at hathawaymix.org
Wed Feb 4 23:22:26 EST 2009
Log message for revision 96121:
Added the `dependent-scripts` option. When set to `true`, scripts will
be generated for all required eggs in addition to the eggs named
specifically.
The implementation is short and simple, but testing it required
changes in a lot of places.
Changed:
U zc.buildout/trunk/src/zc/buildout/downloadcache.txt
U zc.buildout/trunk/src/zc/buildout/easy_install.txt
U zc.buildout/trunk/src/zc/buildout/tests.py
U zc.buildout/trunk/zc.recipe.egg_/CHANGES.txt
U zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt
U zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py
-=-
Modified: zc.buildout/trunk/src/zc/buildout/downloadcache.txt
===================================================================
--- zc.buildout/trunk/src/zc/buildout/downloadcache.txt 2009-02-05 02:45:22 UTC (rev 96120)
+++ zc.buildout/trunk/src/zc/buildout/downloadcache.txt 2009-02-05 04:22:24 UTC (rev 96121)
@@ -33,6 +33,7 @@
>>> print get(link_server),
<html><body>
+ <a href="bigdemo-0.1-py2.4.egg">bigdemo-0.1-py2.4.egg</a><br>
<a href="demo-0.1-py2.4.egg">demo-0.1-py2.4.egg</a><br>
<a href="demo-0.2-py2.4.egg">demo-0.2-py2.4.egg</a><br>
<a href="demo-0.3-py2.4.egg">demo-0.3-py2.4.egg</a><br>
Modified: zc.buildout/trunk/src/zc/buildout/easy_install.txt
===================================================================
--- zc.buildout/trunk/src/zc/buildout/easy_install.txt 2009-02-05 02:45:22 UTC (rev 96120)
+++ zc.buildout/trunk/src/zc/buildout/easy_install.txt 2009-02-05 04:22:24 UTC (rev 96121)
@@ -96,6 +96,7 @@
>>> print get(link_server),
<html><body>
+ <a href="bigdemo-0.1-py2.4.egg">bigdemo-0.1-py2.4.egg</a><br>
<a href="demo-0.1-py2.4.egg">demo-0.1-py2.4.egg</a><br>
<a href="demo-0.2-py2.4.egg">demo-0.2-py2.4.egg</a><br>
<a href="demo-0.3-py2.4.egg">demo-0.3-py2.4.egg</a><br>
@@ -896,6 +897,7 @@
>>> update_extdemo()
>>> print get(link_server),
<html><body>
+ <a href="bigdemo-0.1-py2.4.egg">bigdemo-0.1-py2.4.egg</a><br>
<a href="demo-0.1-py2.4.egg">demo-0.1-py2.4.egg</a><br>
<a href="demo-0.2-py2.4.egg">demo-0.2-py2.4.egg</a><br>
<a href="demo-0.3-py2.4.egg">demo-0.3-py2.4.egg</a><br>
Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py 2009-02-05 02:45:22 UTC (rev 96120)
+++ zc.buildout/trunk/src/zc/buildout/tests.py 2009-02-05 04:22:24 UTC (rev 96121)
@@ -2628,6 +2628,18 @@
" zip_safe=True, version='0.%s%s')\n" % (i, c1)
)
zc.buildout.testing.bdist_egg(tmp, executable, dest)
+
+ write(tmp, 'eggrecipebigdemo.py', 'import eggrecipedemo')
+ write(
+ tmp, 'setup.py',
+ "from setuptools import setup\n"
+ "setup(name='bigdemo', "
+ " install_requires = 'demo',"
+ " py_modules=['eggrecipebigdemo'], "
+ " zip_safe=True, version='0.1')\n"
+ )
+ zc.buildout.testing.bdist_egg(tmp, executable, dest)
+
finally:
shutil.rmtree(tmp)
Modified: zc.buildout/trunk/zc.recipe.egg_/CHANGES.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/CHANGES.txt 2009-02-05 02:45:22 UTC (rev 96120)
+++ zc.buildout/trunk/zc.recipe.egg_/CHANGES.txt 2009-02-05 04:22:24 UTC (rev 96121)
@@ -8,6 +8,16 @@
Change History
**************
+1.1.1 (unreleased)
+==================
+
+- Added the `dependent-scripts` option. When set to `true`, scripts will
+ be generated for all required eggs in addition to the eggs named
+ specifically. This idea came from two forks of this recipe,
+ `repoze.recipe.egg` and `pylons_sandbox`, but the option name is
+ spelled with a dash instead of underscore and it defaults to `false`.
+
+
1.1.0 (2008-07-19)
==================
Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt 2009-02-05 02:45:22 UTC (rev 96120)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt 2009-02-05 04:22:24 UTC (rev 96121)
@@ -33,6 +33,7 @@
>>> print get(link_server),
<html><body>
+ <a href="bigdemo-0.1-py2.3.egg">bigdemo-0.1-py2.3.egg</a><br>
<a href="demo-0.1-py2.3.egg">demo-0.1-py2.3.egg</a><br>
<a href="demo-0.2-py2.3.egg">demo-0.2-py2.3.egg</a><br>
<a href="demo-0.3-py2.3.egg">demo-0.3-py2.3.egg</a><br>
@@ -129,7 +130,7 @@
name=module:attrs
where name is a script name, module is a dotted name resolving to a
- module name, and a attrs is a dotted name resolving to a callable
+ module name, and attrs is a dotted name resolving to a callable
object within a module.
This option is useful when working with distributions that don't
@@ -146,6 +147,10 @@
disabled. If the option isn't given at all, then all scripts
defined by the named eggs will be generated.
+dependent-scripts
+ If set to the string "true", scripts will be generated for all
+ required eggs in addition to the eggs specifically named.
+
interpreter
The name of a script to generate that allows access to a Python
interpreter that has the path set based on the eggs installed.
@@ -482,6 +487,31 @@
if __name__ == '__main__':
foo.bar.a.b.c()
+Generating all scripts
+----------------------
+
+The `bigdemo` package doesn't have any scripts, but it requires the `demo`
+package, which does have a script. Specify `dependent-scripts = true` to
+generate all scripts in required packages:
+
+ >>> write(sample_buildout, 'buildout.cfg',
+ ... """
+ ... [buildout]
+ ... parts = bigdemo
+ ...
+ ... [bigdemo]
+ ... recipe = zc.recipe.egg
+ ... find-links = %(server)s
+ ... index = %(server)s/index
+ ... dependent-scripts = true
+ ... """ % dict(server=link_server))
+ >>> print system(buildout+' -N'),
+ Uninstalling demo.
+ Installing bigdemo.
+ Getting distribution for 'bigdemo'.
+ Got bigdemo 0.1.
+ Generated script '/sample-buildout/bin/demo'.
+
Offline mode
------------
@@ -501,6 +531,6 @@
... """ % dict(server=link_server))
>>> print system(buildout),
- Uninstalling demo.
+ Uninstalling bigdemo.
Installing demo.
Generated script '/sample-buildout/bin/foo'.
Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py 2009-02-05 02:45:22 UTC (rev 96120)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py 2009-02-05 04:22:24 UTC (rev 96121)
@@ -76,12 +76,8 @@
)
else:
kw = {}
- always_unzip = options.get('unzip')
- if always_unzip is not None:
- if always_unzip not in ('true', 'false'):
- raise zc.buildout.UserError("Invalid value for unzip, %s"
- % always_unzip)
- kw['always_unzip'] = always_unzip == 'true'
+ if options.get('unzip'):
+ kw['always_unzip'] = get_bool(options, 'unzip')
ws = zc.buildout.easy_install.install(
distributions, options['eggs-directory'],
@@ -141,6 +137,15 @@
raise zc.buildout.UserError("Invalid entry point")
reqs.append(parsed.groups())
+ if get_bool(options, 'dependent-scripts'):
+ # generate scripts for all packages in the working set,
+ # except setuptools.
+ reqs = list(reqs)
+ for dist in ws:
+ name = dist.project_name
+ if name != 'setuptools' and name not in reqs:
+ reqs.append(name)
+
return zc.buildout.easy_install.scripts(
reqs, ws, options['executable'],
options['bin-directory'],
@@ -155,4 +160,16 @@
update = install
+def get_bool(options, name, default=False):
+ value = options.get(name)
+ if not value:
+ return default
+ if value == 'true':
+ return True
+ elif value == 'false':
+ return False
+ else:
+ raise zc.buildout.UserError(
+ "Invalid value for %s: %s" % (name, value))
+
Egg = Scripts
More information about the Checkins
mailing list