[Checkins] SVN: zc.buildout/branches/help-api/ - Added `environment` option to custom extension building options.

Godefroid Chapelle gotcha at bubblenet.be
Sun Mar 29 17:17:02 EDT 2009


Log message for revision 98467:
  - Added `environment` option to custom extension building options.

Changed:
  U   zc.buildout/branches/help-api/src/zc/buildout/tests.py
  U   zc.buildout/branches/help-api/zc.recipe.egg_/CHANGES.txt
  U   zc.buildout/branches/help-api/zc.recipe.egg_/src/zc/recipe/egg/custom.py
  U   zc.buildout/branches/help-api/zc.recipe.egg_/src/zc/recipe/egg/custom.txt

-=-
Modified: zc.buildout/branches/help-api/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/help-api/src/zc/buildout/tests.py	2009-03-29 21:16:55 UTC (rev 98466)
+++ zc.buildout/branches/help-api/src/zc/buildout/tests.py	2009-03-29 21:17:02 UTC (rev 98467)
@@ -2885,8 +2885,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/branches/help-api/zc.recipe.egg_/CHANGES.txt
===================================================================
--- zc.buildout/branches/help-api/zc.recipe.egg_/CHANGES.txt	2009-03-29 21:16:55 UTC (rev 98466)
+++ zc.buildout/branches/help-api/zc.recipe.egg_/CHANGES.txt	2009-03-29 21:17:02 UTC (rev 98467)
@@ -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/branches/help-api/zc.recipe.egg_/src/zc/recipe/egg/custom.py
===================================================================
--- zc.buildout/branches/help-api/zc.recipe.egg_/src/zc/recipe/egg/custom.py	2009-03-29 21:16:55 UTC (rev 98466)
+++ zc.buildout/branches/help-api/zc.recipe.egg_/src/zc/recipe/egg/custom.py	2009-03-29 21:17:02 UTC (rev 98467)
@@ -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/branches/help-api/zc.recipe.egg_/src/zc/recipe/egg/custom.txt
===================================================================
--- zc.buildout/branches/help-api/zc.recipe.egg_/src/zc/recipe/egg/custom.txt	2009-03-29 21:16:55 UTC (rev 98466)
+++ zc.buildout/branches/help-api/zc.recipe.egg_/src/zc/recipe/egg/custom.txt	2009-03-29 21:17:02 UTC (rev 98467)
@@ -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