[Checkins] SVN: z3c.recipe.dev/trunk/ added support for environment in script recipe

Roger Ineichen roger at projekt01.ch
Tue Jul 6 19:54:27 EDT 2010


Log message for revision 114274:
  added support for environment in script recipe

Changed:
  U   z3c.recipe.dev/trunk/CHANGES.txt
  U   z3c.recipe.dev/trunk/src/z3c/recipe/dev/README.txt
  U   z3c.recipe.dev/trunk/src/z3c/recipe/dev/script.py

-=-
Modified: z3c.recipe.dev/trunk/CHANGES.txt
===================================================================
--- z3c.recipe.dev/trunk/CHANGES.txt	2010-07-06 23:09:34 UTC (rev 114273)
+++ z3c.recipe.dev/trunk/CHANGES.txt	2010-07-06 23:54:27 UTC (rev 114274)
@@ -5,7 +5,7 @@
 0.5.5dev (unreleased)
 ---------------------
 
-- ...
+- added support for environment
 
 
 0.5.4 (2009-02-22)

Modified: z3c.recipe.dev/trunk/src/z3c/recipe/dev/README.txt
===================================================================
--- z3c.recipe.dev/trunk/src/z3c/recipe/dev/README.txt	2010-07-06 23:09:34 UTC (rev 114273)
+++ z3c.recipe.dev/trunk/src/z3c/recipe/dev/README.txt	2010-07-06 23:54:27 UTC (rev 114274)
@@ -236,7 +236,10 @@
   All the string will be copied to the script 1:1.
   So what you enter here is what you get.
 
+environment
+  The environement if needed by your script
 
+
 Test
 ~~~~
 

Modified: z3c.recipe.dev/trunk/src/z3c/recipe/dev/script.py
===================================================================
--- z3c.recipe.dev/trunk/src/z3c/recipe/dev/script.py	2010-07-06 23:09:34 UTC (rev 114273)
+++ z3c.recipe.dev/trunk/src/z3c/recipe/dev/script.py	2010-07-06 23:54:27 UTC (rev 114274)
@@ -60,7 +60,13 @@
 
         wd = options.get('working-directory', options['location'])
 
+        # setup environment
         initialization = initialization_template
+        env_section = self.options.get('environment', '').strip()
+        if env_section:
+            env = self.buildout[env_section]
+            for key, value in env.items():
+                initialization += env_template % (key, value)
 
         return zc.buildout.easy_install.scripts(
             [(options['script'], module, method)],
@@ -78,3 +84,6 @@
 initialization_template = """import os
 sys.argv[0] = os.path.abspath(sys.argv[0])
 """
+
+env_template = """os.environ['%s'] = %r
+"""



More information about the checkins mailing list