[Checkins] SVN: z3c.recipe.egg_/trunk/z3c/recipe/egg/ * Add support
for operating on part initialization to the setup recipe
Ross Patterson
me at rpatterson.net
Fri Jun 6 14:39:20 EDT 2008
Log message for revision 87215:
* Add support for operating on part initialization to the setup recipe
Changed:
U z3c.recipe.egg_/trunk/z3c/recipe/egg/__init__.py
U z3c.recipe.egg_/trunk/z3c/recipe/egg/setup.txt
-=-
Modified: z3c.recipe.egg_/trunk/z3c/recipe/egg/__init__.py
===================================================================
--- z3c.recipe.egg_/trunk/z3c/recipe/egg/__init__.py 2008-06-06 18:20:04 UTC (rev 87214)
+++ z3c.recipe.egg_/trunk/z3c/recipe/egg/__init__.py 2008-06-06 18:39:19 UTC (rev 87215)
@@ -1,11 +1,10 @@
import sys, os, pkg_resources, subprocess
import distutils.core
-import setuptools.command.easy_install
-import zc.buildout.easy_install
+from zc.buildout import easy_install
import zc.recipe.egg
-ei_logger = zc.buildout.easy_install.logger
+ei_logger = easy_install.logger
class Setup(object):
@@ -13,8 +12,20 @@
self.buildout = buildout
self.name = name
self.options = options
+ self.onInit = (
+ options.setdefault('init', 'True').lower()
+ in ['true', 'yes', '1'])
+ if self.onInit:
+ self.setup()
def install(self):
+ if not self.onInit:
+ self.setup()
+ return ()
+
+ update = install
+
+ def setup(self):
setups = [os.path.join(self.buildout['buildout']['directory'],
setup.strip())
for setup in self.options['setup'].split('\n')
@@ -26,11 +37,7 @@
if self.options.get('develop') == 'true':
develop(self, setups)
-
- return ()
- update = install
-
class Editable(zc.recipe.egg.Eggs):
def __init__(self, buildout, name, options):
@@ -69,7 +76,7 @@
os.path.isdir(os.path.join(
self.options['build-directory'], req.key))]
if len(dists) > 0:
- args = ['-c', zc.buildout.easy_install._easy_install_cmd]
+ args = ['-c', easy_install._easy_install_cmd]
if options.get('unzip') == 'true':
args += ['-Z']
@@ -116,7 +123,7 @@
def get_online_versions(self):
options = self.options
- self.installer = zc.buildout.easy_install.Installer(
+ self.installer = easy_install.Installer(
links=self.links,
index = self.index,
executable = options['executable'],
@@ -146,6 +153,6 @@
def develop(self, setups):
for setup in setups:
self.buildout._logger.info("Develop: %r", setup)
- zc.buildout.easy_install.develop(
+ easy_install.develop(
setup=setup, dest=self.buildout['buildout'][
'develop-eggs-directory'])
Modified: z3c.recipe.egg_/trunk/z3c/recipe/egg/setup.txt
===================================================================
--- z3c.recipe.egg_/trunk/z3c/recipe/egg/setup.txt 2008-06-06 18:20:04 UTC (rev 87214)
+++ z3c.recipe.egg_/trunk/z3c/recipe/egg/setup.txt 2008-06-06 18:39:19 UTC (rev 87215)
@@ -23,7 +23,6 @@
The seupt script is run with the specified arguments.
>>> print system(buildout),
- Installing foo.
Running setup script '/sample-buildout/foo/setup.py'.
running sdist
running egg_info
@@ -49,6 +48,7 @@
tar -cf dist/foo-0.0.0.tar foo-0.0.0
gzip -f9 dist/foo-0.0.0.tar
removing 'foo-0.0.0' (and everything under it)
+ Installing foo.
>>> ls(sample_buildout, 'foo', 'dist')
- foo-0.0.0.tar.gz
@@ -58,7 +58,6 @@
The setup script is also run on update.
>>> print system(buildout),
- Updating foo.
Running setup script '/sample-buildout/foo/setup.py'.
running sdist
running egg_info
@@ -81,6 +80,7 @@
tar -cf dist/foo-0.0.0.tar foo-0.0.0
gzip -f9 dist/foo-0.0.0.tar
removing 'foo-0.0.0' (and everything under it)
+ Updating foo.
>>> ls(sample_buildout, 'foo', 'dist')
- foo-0.0.0.tar.gz
@@ -106,8 +106,6 @@
Now the buildout will run the setup script on both.
>>> print system(buildout),
- Uninstalling foo.
- Installing foo.
Running setup script '/sample-buildout/foo/setup.py'.
running sdist
running egg_info
@@ -155,6 +153,8 @@
tar -cf dist/bar-0.0.0.tar bar-0.0.0
gzip -f9 dist/bar-0.0.0.tar
removing 'bar-0.0.0' (and everything under it)
+ Uninstalling foo.
+ Installing foo.
>>> ls(sample_buildout, 'foo', 'dist')
- foo-0.0.0.tar.gz
@@ -181,13 +181,34 @@
... """)
>>> print system(buildout),
+ Develop: '/sample-buildout/foo'
+ Develop: '/sample-buildout/bar'
Uninstalling foo.
Installing foo.
- Develop: '/sample-buildout/foo'
- Develop: '/sample-buildout/bar'
>>> ls(sample_buildout, 'develop-eggs')
- bar.egg-link
- foo.egg-link
- z3c.recipe.egg.egg-link
- zc.recipe.egg.egg-link
+
+If the init option is not True, the default, then the setup script
+will be run when the part is installed or updated rather than when it
+is initialized.
+
+ >>> write(sample_buildout, 'buildout.cfg',
+ ... """
+ ... [buildout]
+ ... parts = foo
+ ...
+ ... [foo]
+ ... recipe = z3c.recipe.egg:setup
+ ... setup = foo
+ ... develop = true
+ ... init = False
+ ... """)
+
+ >>> print system(buildout),
+ Uninstalling foo.
+ Installing foo.
+ Develop: '/sample-buildout/foo'
More information about the Checkins
mailing list