[Checkins] SVN: zc.buildout/trunk/ - Added `environment` option to
custom extension building options.
Christian Zagrodnick
cz at gocept.com
Mon Feb 18 05:24:10 EST 2008
Log message for revision 84015:
- Added `environment` option to custom extension building options.
Changed:
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/custom.py
U zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.txt
-=-
Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py 2008-02-18 10:15:59 UTC (rev 84014)
+++ zc.buildout/trunk/src/zc/buildout/tests.py 2008-02-18 10:24:10 UTC (rev 84015)
@@ -2475,8 +2475,12 @@
"""
extdemo_setup_py = """
+import os
from distutils.core import setup, Extension
+if os.environ.get('test-variable'):
+ print "Have environment test-variable:", os.environ['test-variable']
+
setup(name = "extdemo", version = "%s", url="http://www.zope.org",
author="Demo", author_email="demo at demo.com",
ext_modules = [Extension('extdemo', ['extdemo.c'])],
Modified: zc.buildout/trunk/zc.recipe.egg_/CHANGES.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/CHANGES.txt 2008-02-18 10:15:59 UTC (rev 84014)
+++ zc.buildout/trunk/zc.recipe.egg_/CHANGES.txt 2008-02-18 10:24:10 UTC (rev 84015)
@@ -8,6 +8,11 @@
Change History
**************
+1.1.0 (unreleased)
+==================
+
+- Added `environment` option to custom extension building options.
+
1.0.0 (2007-11-03)
==================
Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.py
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.py 2008-02-18 10:15:59 UTC (rev 84014)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.py 2008-02-18 10:24:10 UTC (rev 84015)
@@ -57,6 +57,11 @@
options['index'] = index
self.index = index
+ environment_section = options.get('envirionment')
+ if environment_section:
+ for key, value in buildout[environment_section].items():
+ os.environ[key] = value
+
options['_e'] = buildout['buildout']['eggs-directory']
assert options.get('unzip') in ('true', 'false', None)
Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.txt 2008-02-18 10:15:59 UTC (rev 84014)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.txt 2008-02-18 10:24:10 UTC (rev 84015)
@@ -83,7 +83,7 @@
section.
environment
- The name of a section wich additional environment variables. The
+ The name of a section with additional environment variables. The
envirionment variables are set before the egg is built.
To illustrate this, we'll define a buildout that builds an egg for a
@@ -129,20 +129,29 @@
... [buildout]
... parts = extdemo
...
+ ... [extdemo-env]
+ ... test-variable = foo
+ ...
... [extdemo]
... recipe = zc.recipe.egg:custom
... find-links = %(server)s
... index = %(server)s/index
... include-dirs = include
+ ... envirionment = extdemo-env
+ ...
... """ % dict(server=link_server))
>>> print system(buildout),
Installing extdemo.
+ Have environment test-variable: foo
zip_safe flag not set; analyzing archive contents...
We got the zip_safe warning because the source distribution we used
wasn't setuptools based and thus didn't set the option.
+The setup.py also printed out that we have set the environment `test-variable`
+to foo.
+
The egg is created in the develop-eggs directory *not* the eggs
directory because it depends on buildout-specific parameters and the
eggs directory can be shared across multiple buildouts.
@@ -179,11 +188,15 @@
... develop = demo
... parts = extdemo demo
...
+ ... [extdemo-env]
+ ... test-variable = foo
+ ...
... [extdemo]
... recipe = zc.recipe.egg:custom
... find-links = %(server)s
... index = %(server)s/index
... include-dirs = include
+ ... envirionment = extdemo-env
...
... [demo]
... recipe = zc.recipe.egg
@@ -233,11 +246,13 @@
- zc.recipe.egg.egg-link
But if we run the buildout in the default on-line and newest modes, we
-will:
+will. This time we also get the test-variable message again, because the new
+version is imported:
>>> print system(buildout),
Develop: '/sample-buildout/demo'
Updating extdemo.
+ Have environment test-variable: foo
zip_safe flag not set; analyzing archive contents...
Updating demo.
Generated script '/sample-buildout/bin/demo'.
More information about the Checkins
mailing list