diff --git a/CHANGES.txt b/CHANGES.txt index 73c80869b1ece9b50b64a0794d8416950ec249e6..a57d1f20cc176e3ab3f6896c86f5ed4ad50b6e3f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -20,6 +20,22 @@ priorities include: 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) ===================== diff --git a/src/zc/buildout/tests.py b/src/zc/buildout/tests.py index 9dc19b49bbef7da579aa8d704b4ac1485feeed87..f03ccb20ec4899cc4fd921b5030474af39ff9aec 100644 --- a/src/zc/buildout/tests.py +++ b/src/zc/buildout/tests.py @@ -984,7 +984,7 @@ def makeNewRelease(project, ws, dest): ) 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 @@ def test_suite(): '__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 @@ def test_suite(): '\\1.egg'), (re.compile('(zc.buildout|setuptools)( version)? \d+[.]\d+\S*'), '\\1 V.V'), + (re.compile('[-d] setuptools'), '- setuptools'), ]) ), diff --git a/zc.recipe.egg_/setup.py b/zc.recipe.egg_/setup.py index 6b321c08282be1c97a9e5b7479cc34b2799b3289..135b5a9ece1c6b4fdb5e4d7f9bfe07caad53847a 100644 --- a/zc.recipe.egg_/setup.py +++ b/zc.recipe.egg_/setup.py @@ -41,8 +41,10 @@ setup( 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, ] diff --git a/zc.recipe.egg_/src/zc/recipe/egg/README.txt b/zc.recipe.egg_/src/zc/recipe/egg/README.txt index 0c3b07f00815c48ad4461b4780b3938a8450e9de..adaaad62c59746b15c41eacf96d791ad347a076c 100644 --- a/zc.recipe.egg_/src/zc/recipe/egg/README.txt +++ b/zc.recipe.egg_/src/zc/recipe/egg/README.txt @@ -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 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 @@ We have a link server that has a number of distributions: <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 @@ install the demo package. ... 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,15 +90,59 @@ a regular egg installation.) 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: @@ -138,6 +159,10 @@ Let's add an interpreter option: ... 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 @@ This is useful for debugging and testing. - demo - py-demo - If we run the demo script, it prints out some minimal data: >>> print system(os.path.join(sample_buildout, 'bin', 'demo')), diff --git a/zc.recipe.egg_/src/zc/recipe/egg/__init__.py b/zc.recipe.egg_/src/zc/recipe/egg/__init__.py index 04fa6e284427d0673b3cd4558da2a3c1f94ba744..b63fb85f5d59898bd884c41fa8b02b30f33aa5cb 100644 --- a/zc.recipe.egg_/src/zc/recipe/egg/__init__.py +++ b/zc.recipe.egg_/src/zc/recipe/egg/__init__.py @@ -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 diff --git a/zc.recipe.egg_/src/zc/recipe/egg/api.txt b/zc.recipe.egg_/src/zc/recipe/egg/api.txt index ec2f378ca5ac2ddc5c97d512bacafda330f1067f..0e70ca1a68d443ffd74b1c12c9d2ecfa88ff0865 100644 --- a/zc.recipe.egg_/src/zc/recipe/egg/api.txt +++ b/zc.recipe.egg_/src/zc/recipe/egg/api.txt @@ -23,7 +23,7 @@ around the egg recipe: ... 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 @@ computed by the egg recipe by looking at .installed.cfg: _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 @@ recipe instance: other 1.0 demoneeded 1.1 extra paths: ['/foo/bar', '/spam/eggs'] + diff --git a/zc.recipe.egg_/src/zc/recipe/egg/egg.py b/zc.recipe.egg_/src/zc/recipe/egg/egg.py index 599e96f1804a1f4e114a50958e3095ac5221182e..a42fc5b54e2975c835426ffaccafe652b806a777 100644 --- a/zc.recipe.egg_/src/zc/recipe/egg/egg.py +++ b/zc.recipe.egg_/src/zc/recipe/egg/egg.py @@ -19,7 +19,7 @@ $Id$ 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 @@ class Egg: 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 @@ class Egg: 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 @@ class Egg: 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 @@ class Egg: return () update = install + +Egg = Scripts diff --git a/zc.recipe.egg_/src/zc/recipe/egg/tests.py b/zc.recipe.egg_/src/zc/recipe/egg/tests.py index 130ca7538eea4417bf0256aededb03d23d229abe..8cc79cc3fa1aa6c3cc42eb1c48a23e847b396aa3 100644 --- a/zc.recipe.egg_/src/zc/recipe/egg/tests.py +++ b/zc.recipe.egg_/src/zc/recipe/egg/tests.py @@ -49,7 +49,7 @@ def test_suite(): 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(