[Checkins] SVN: zc.recipe.cmmi/trunk/ Add support for updating the environment

Wichert Akkerman wichert at wiggy.net
Tue Jun 3 07:18:46 EDT 2008


Log message for revision 87126:
  Add support for updating the environment

Changed:
  U   zc.recipe.cmmi/trunk/CHANGES.txt
  U   zc.recipe.cmmi/trunk/zc/recipe/cmmi/README.txt
  U   zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py

-=-
Modified: zc.recipe.cmmi/trunk/CHANGES.txt
===================================================================
--- zc.recipe.cmmi/trunk/CHANGES.txt	2008-06-03 10:04:47 UTC (rev 87125)
+++ zc.recipe.cmmi/trunk/CHANGES.txt	2008-06-03 11:18:45 UTC (rev 87126)
@@ -3,7 +3,7 @@
 1.1.3 (unreleased)
 ==================
 
-...
+Add support for updating the environment.
 
 1.1.2 (2008-02-28)
 ==================

Modified: zc.recipe.cmmi/trunk/zc/recipe/cmmi/README.txt
===================================================================
--- zc.recipe.cmmi/trunk/zc/recipe/cmmi/README.txt	2008-06-03 10:04:47 UTC (rev 87125)
+++ zc.recipe.cmmi/trunk/zc/recipe/cmmi/README.txt	2008-06-03 11:18:45 UTC (rev 87126)
@@ -81,6 +81,34 @@
     location = /sample-buildout/parts/foo
     ...
 
+It may be necessary to set some environment variables when running configure
+or make. This can be done by adding an environment statement:
+
+    >>> write('buildout.cfg',
+    ... """
+    ... [buildout]
+    ... parts = foo
+    ...
+    ... [foo]
+    ... recipe = zc.recipe.cmmi
+    ... url = file://%s/foo.tgz
+    ... environment =
+    ...   CFLAGS=-I/usr/lib/postgresql7.4/include
+    ... """ % distros)
+
+
+    >>> print system('bin/buildout'),
+    Uninstalling foo.
+    Installing foo.
+    foo: Downloading .../distros/foo.tgz
+    foo: Unpacking and configuring
+    foo: Updating environment: CFLAGS=-I/usr/lib/postgresql7.4/include
+    configuring foo --prefix=/sample_buildout/parts/foo
+    echo building foo
+    building foo
+    echo installing foo
+    installing foo
+
 Sometimes it's necessary to patch the sources before building a package.
 You can specify the name of the patch to apply and (optional) patch options:
 

Modified: zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py
===================================================================
--- zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py	2008-06-03 10:04:47 UTC (rev 87125)
+++ zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py	2008-06-03 11:18:45 UTC (rev 87126)
@@ -71,6 +71,13 @@
         if not os.path.exists(dest):
             os.mkdir(dest)
 
+        environ = self.options.get('environment', '').split()
+        if environ:
+            for entry in environ:
+                logger.info('Updating environment: %s' % entry)
+            environ = dict([x.split('=', 1) for x in environ])
+            os.environ.update(environ)
+
         try:
             os.chdir(tmp)
             try:



More information about the Checkins mailing list