[Checkins] SVN: zc.buildout/trunk/ - Added documentation for some
previously undocumented features of the
Jim Fulton
jim at zope.com
Wed Jan 17 12:25:02 EST 2007
Log message for revision 72071:
- Added documentation for some previously undocumented features of the
easy_install APIs.
- Added an eggs recipe that *just* installes eggs.
- Advertized the scripts recipe for creating scripts.
Updated some tests to deal with the fact that setuptools eggs keep
oscillating between being files and directories.
Changed:
U zc.buildout/trunk/CHANGES.txt
U zc.buildout/trunk/src/zc/buildout/tests.py
U zc.buildout/trunk/zc.recipe.egg_/setup.py
U zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt
U zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/__init__.py
U zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/api.txt
U zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py
U zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py
-=-
Modified: zc.buildout/trunk/CHANGES.txt
===================================================================
--- zc.buildout/trunk/CHANGES.txt 2007-01-17 13:08:54 UTC (rev 72070)
+++ zc.buildout/trunk/CHANGES.txt 2007-01-17 17:25:00 UTC (rev 72071)
@@ -20,6 +20,22 @@
Change History
**************
+1.0.0b18 (2007-01-17)
+=====================
+
+Feature Changes
+---------------
+
+- Added documentation for some previously undocumented features of the
+ easy_install APIs.
+
+- Added an eggs recipe that *just* installes eggs.
+
+- Advertized the scripts recipe for creating scripts.
+
+Bugs Fixed
+----------
+
1.0.0b17 (2006-12-07)
=====================
Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py 2007-01-17 13:08:54 UTC (rev 72070)
+++ zc.buildout/trunk/src/zc/buildout/tests.py 2007-01-17 17:25:00 UTC (rev 72071)
@@ -984,7 +984,7 @@
)
zip.close()
else:
- shutil.copy(dist.location, dest)
+ shutil.copytree(dist.location, dest)
info_path = os.path.join(dest, 'EGG-INFO', 'PKG-INFO')
info = open(info_path).read().replace("Version: %s" % oldver,
"Version: 99.99")
@@ -1057,7 +1057,7 @@
'__buildout_signature__ = recipes-SSSSSSSSSSS'),
(re.compile('executable = \S+python\S*'),
'executable = python'),
- (re.compile('setuptools-\S+[.]egg'), 'setuptools.egg'),
+ (re.compile('[-d] setuptools-\S+[.]egg'), 'setuptools.egg'),
(re.compile('zc.buildout(-\S+)?[.]egg(-link)?'),
'zc.buildout.egg'),
(re.compile('creating \S*setup.cfg'), 'creating setup.cfg'),
@@ -1080,6 +1080,7 @@
'\\1.egg'),
(re.compile('(zc.buildout|setuptools)( version)? \d+[.]\d+\S*'),
'\\1 V.V'),
+ (re.compile('[-d] setuptools'), '- setuptools'),
])
),
Modified: zc.buildout/trunk/zc.recipe.egg_/setup.py
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/setup.py 2007-01-17 13:08:54 UTC (rev 72070)
+++ zc.buildout/trunk/zc.recipe.egg_/setup.py 2007-01-17 17:25:00 UTC (rev 72071)
@@ -41,8 +41,10 @@
install_requires = ['zc.buildout >=1.0.0b3', 'setuptools'],
tests_require = ['zope.testing'],
test_suite = name+'.tests.test_suite',
- entry_points = {'zc.buildout': ['default = %s:Egg' % name,
- 'script = %s:Egg' % name,
+ entry_points = {'zc.buildout': ['default = %s:Scripts' % name,
+ 'script = %s:Scripts' % name,
+ 'scripts = %s:Scripts' % name,
+ 'eggs = %s:Eggs' % name,
'custom = %s:Custom' % name,
'develop = %s:Develop' % name,
]
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 2007-01-17 13:08:54 UTC (rev 72070)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt 2007-01-17 17:25:00 UTC (rev 72071)
@@ -1,7 +1,7 @@
Installation of distributions as eggs
=====================================
-The zc.recipe.egg recipe can be used to install various types if
+The zc.recipe.egg:eggs recipe can be used to install various types if
distutils distributions as eggs. It takes a number of options:
eggs
@@ -29,28 +29,6 @@
Python executable is found in the executable option of the named
section.
-entry-points
- A list of entry-point identifiers of the form name=module#attrs,
- name is a script name, module is a module name, and a attrs is a
- (possibly dotted) name of an object wihin the module. This option
- is useful when working with distributions that don't declare entry
- points, such as distributions not written to work with setuptools.
-
-scripts
- Control which scripts are generated. The value should be a list of
- zero or more tokens. Each token is either a name, or a name
- followed by an '=' and a new name. Only the named scripts are
- generated. If no tokens are given, then script generation is
- disabled. If the option isn't given at all, then all scripts
- defined by the named eggs will be generated.
-
-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.
-
-extra-paths
- Extra paths to include in a generates script.
-
We have a link server that has a number of distributions:
>>> print get(link_server),
@@ -65,7 +43,6 @@
<a href="other-1.0-py2.3.egg">other-1.0-py2.3.egg</a><br>
</body></html>
-
We have a sample buildout. Let's update it's configuration file to
install the demo package.
@@ -75,7 +52,7 @@
... parts = demo
...
... [demo]
- ... recipe = zc.recipe.egg
+ ... recipe = zc.recipe.egg:eggs
... eggs = demo<0.3
... find-links = %(server)s
... index = %(server)s/index
@@ -113,16 +90,60 @@
Script generation
-----------------
-The demo egg also defined a script and we see that the script was
-installed as well:
+The demo egg defined a script, but we didn't get one installed:
>>> ls(sample_buildout, 'bin')
- buildout
+
+If we want scripts provided by eggs to be installed, we should use the
+scripts recipe:
+
+ >>> write(sample_buildout, 'buildout.cfg',
+ ... """
+ ... [buildout]
+ ... parts = demo
+ ...
+ ... [demo]
+ ... recipe = zc.recipe.egg:scripts
+ ... eggs = demo<0.3
+ ... find-links = %(server)s
+ ... index = %(server)s/index
+ ... """ % dict(server=link_server))
+
+ >>> print system(buildout),
+ buildout: Uninstalling demo
+ buildout: Installing demo
+
+Now we also see the script defined by the dmo script:
+
+ >>> ls(sample_buildout, 'bin')
+ - buildout
- demo
-Here, in addition to the buildout script, we see the demo script,
-demo.
+The scripts recipe defines some additional options:
+entry-points
+ A list of entry-point identifiers of the form name=module#attrs,
+ name is a script name, module is a module name, and a attrs is a
+ (possibly dotted) name of an object wihin the module. This option
+ is useful when working with distributions that don't declare entry
+ points, such as distributions not written to work with setuptools.
+
+scripts
+ Control which scripts are generated. The value should be a list of
+ zero or more tokens. Each token is either a name, or a name
+ followed by an '=' and a new name. Only the named scripts are
+ generated. If no tokens are given, then script generation is
+ disabled. If the option isn't given at all, then all scripts
+ defined by the named eggs will be generated.
+
+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.
+
+extra-paths
+ Extra paths to include in a generates script.
+
Let's add an interpreter option:
>>> write(sample_buildout, 'buildout.cfg',
@@ -138,6 +159,10 @@
... interpreter = py-demo
... """ % dict(server=link_server))
+Note that we ommitted the entry point name from the recipe
+specification. We were able to do this because the scripts recipe if
+the default entry point for the zc.recipe.egg egg.
+
>>> print system(buildout),
buildout: Uninstalling demo
buildout: Installing demo
@@ -151,7 +176,6 @@
- demo
- py-demo
-
If we run the demo script, it prints out some minimal data:
>>> print system(os.path.join(sample_buildout, 'bin', 'demo')),
Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/__init__.py
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/__init__.py 2007-01-17 13:08:54 UTC (rev 72070)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/__init__.py 2007-01-17 17:25:00 UTC (rev 72071)
@@ -1,2 +1,2 @@
-from zc.recipe.egg.egg import Egg
+from zc.recipe.egg.egg import Egg, Scripts, Eggs
from zc.recipe.egg.custom import Custom, Develop
Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/api.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/api.txt 2007-01-17 13:08:54 UTC (rev 72070)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/api.txt 2007-01-17 17:25:00 UTC (rev 72071)
@@ -23,7 +23,7 @@
... class Sample:
...
... def __init__(self, buildout, name, options):
- ... self.egg = zc.recipe.egg.Egg(buildout, name, options)
+ ... self.egg = zc.recipe.egg.Scripts(buildout, name, options)
... self.name = name
... self.options = options
...
@@ -108,7 +108,10 @@
_b = /sample-buildout/bin
_d = /sample-buildout/develop-eggs
_e = /sample-buildout/eggs
+ bin-directory = /sample-buildout/bin
+ develop-eggs-directory = /sample-buildout/develop-eggs
eggs = demo<0.3
+ eggs-directory = /sample-buildout/eggs
executable = /usr/local/bin/python2.3
extras = other
find-links = http://localhost:27071/
@@ -146,3 +149,4 @@
other 1.0
demoneeded 1.1
extra paths: ['/foo/bar', '/spam/eggs']
+
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 2007-01-17 13:08:54 UTC (rev 72070)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py 2007-01-17 17:25:00 UTC (rev 72071)
@@ -19,7 +19,7 @@
import logging, os, re, zipfile
import zc.buildout.easy_install
-class Egg:
+class Eggs(object):
def __init__(self, buildout, name, options):
self.buildout = buildout
@@ -39,18 +39,12 @@
options['index'] = index
self.index = index
- self.extra_paths = [
- os.path.join(buildout['buildout']['directory'], p.strip())
- for p in options.get('extra-paths', '').split('\n')
- if p.strip()
- ]
- if self.extra_paths:
- options['extra-paths'] = '\n'.join(self.extra_paths)
-
- options['_b'] = buildout['buildout']['bin-directory']
- options['_e'] = buildout['buildout']['eggs-directory']
- options['_d'] = buildout['buildout']['develop-eggs-directory']
-
+ options['eggs-directory'] = buildout['buildout']['eggs-directory']
+ options['_e'] = options['eggs-directory'] # backward compat.
+ options['develop-eggs-directory'
+ ] = buildout['buildout']['develop-eggs-directory']
+ options['_d'] = options['develop-eggs-directory'] # backward compat.
+
assert options.get('unzip') in ('true', 'false', None)
python = options.get('python', buildout['buildout']['python'])
@@ -73,20 +67,42 @@
if self.buildout['buildout'].get('offline') == 'true':
ws = zc.buildout.easy_install.working_set(
distributions, options['executable'],
- [options['_d'], options['_e']]
+ [options['develop-eggs-directory'], options['eggs-directory']]
)
else:
ws = zc.buildout.easy_install.install(
- distributions, options['_e'],
+ distributions, options['eggs-directory'],
links = self.links,
index = self.index,
executable = options['executable'],
always_unzip=options.get('unzip') == 'true',
- path=[options['_d']]
+ path=[options['develop-eggs-directory']]
)
return orig_distributions, ws
+ def install(self):
+ reqs, ws = self.working_set()
+ return ()
+
+ update = install
+
+class Scripts(Eggs):
+
+ def __init__(self, buildout, name, options):
+ super(Scripts, self).__init__(buildout, name, options)
+
+ options['bin-directory'] = buildout['buildout']['bin-directory']
+ options['_b'] = options['bin-directory'] # backward compat.
+
+ self.extra_paths = [
+ os.path.join(buildout['buildout']['directory'], p.strip())
+ for p in options.get('extra-paths', '').split('\n')
+ if p.strip()
+ ]
+ if self.extra_paths:
+ options['extra-paths'] = '\n'.join(self.extra_paths)
+
parse_entry_point = re.compile(
'([^=]+)=(\w+(?:[.]\w+)*):(\w+(?:[.]\w+)*)$'
).match
@@ -113,7 +129,7 @@
return zc.buildout.easy_install.scripts(
reqs, ws, options['executable'],
- options['_b'],
+ options['bin-directory'],
scripts=scripts,
extra_paths=self.extra_paths,
interpreter=options.get('interpreter'),
@@ -122,3 +138,5 @@
return ()
update = install
+
+Egg = Scripts
Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py 2007-01-17 13:08:54 UTC (rev 72070)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py 2007-01-17 17:25:00 UTC (rev 72071)
@@ -49,7 +49,7 @@
zc.buildout.tests.normalize_bang,
(re.compile('zc.buildout(-\S+)?[.]egg(-link)?'),
'zc.buildout.egg'),
- (re.compile('setuptools-[^-]+-'), 'setuptools-X-')
+ (re.compile('[-d] setuptools-[^-]+-'), 'setuptools-X-')
])
),
doctest.DocFileSuite(
More information about the Checkins
mailing list