[Zope-Checkins] SVN: zdaemon/branches/jim-env/src/zdaemon/ checkpoint

Jim Fulton jim at zope.com
Mon Jan 8 07:44:20 EST 2007


Log message for revision 71792:
  checkpoint

Changed:
  U   zdaemon/branches/jim-env/src/zdaemon/README.txt
  U   zdaemon/branches/jim-env/src/zdaemon/component.xml
  U   zdaemon/branches/jim-env/src/zdaemon/schema.xml
  U   zdaemon/branches/jim-env/src/zdaemon/zdctl.py

-=-
Modified: zdaemon/branches/jim-env/src/zdaemon/README.txt
===================================================================
--- zdaemon/branches/jim-env/src/zdaemon/README.txt	2007-01-08 12:04:34 UTC (rev 71791)
+++ zdaemon/branches/jim-env/src/zdaemon/README.txt	2007-01-08 12:44:19 UTC (rev 71792)
@@ -137,6 +137,31 @@
     >>> system("./zdaemon -Cconf stop")
     daemon process stopped
 
+
+
+Environment Variables
+---------------------
+
+Sometimes, it is necessary to set environment variables before running
+a program.  Perhaps the most common case for this is setting
+LD_LIBRARY_PATH so that dynamically loaded libraries can be found.
+
+
+    >>> open('conf', 'w').write(
+    ... '''
+    ... <runner>
+    ...   program env
+    ...   socket-name /tmp/demo.zdsock
+    ... </runner>
+    ... <environment>
+    ...   LD_LIBRARY_PATH = /home/foo/lib
+    ...   HOME = /home/foo
+    ... </environment>
+    ... ''')
+
+    >>> system("./zdaemon -Cconf fg")
+
+
 Reference Documentation
 -----------------------
 

Modified: zdaemon/branches/jim-env/src/zdaemon/component.xml
===================================================================
--- zdaemon/branches/jim-env/src/zdaemon/component.xml	2007-01-08 12:04:34 UTC (rev 71791)
+++ zdaemon/branches/jim-env/src/zdaemon/component.xml	2007-01-08 12:44:19 UTC (rev 71792)
@@ -272,4 +272,11 @@
 
   </sectiontype>
 
+  <sectiontype name="environment">
+    <key name="+"
+         attribute="mapping"
+         required="no"
+         />
+  </sectiontype>
+
 </component>

Modified: zdaemon/branches/jim-env/src/zdaemon/schema.xml
===================================================================
--- zdaemon/branches/jim-env/src/zdaemon/schema.xml	2007-01-08 12:04:34 UTC (rev 71791)
+++ zdaemon/branches/jim-env/src/zdaemon/schema.xml	2007-01-08 12:44:19 UTC (rev 71792)
@@ -21,6 +21,8 @@
 
   <section name="*" type="runner" attribute="runner" required="yes" />
 
+  <section name="*" type="environment" attribute="environment" required="no" />
+
   <section name="*" type="eventlog" attribute="eventlog" required="no" />
 
 </schema>

Modified: zdaemon/branches/jim-env/src/zdaemon/zdctl.py
===================================================================
--- zdaemon/branches/jim-env/src/zdaemon/zdctl.py	2007-01-08 12:04:34 UTC (rev 71791)
+++ zdaemon/branches/jim-env/src/zdaemon/zdctl.py	2007-01-08 12:44:19 UTC (rev 71792)
@@ -134,6 +134,13 @@
                     print "our program   =", program
                     print "daemon's args =", args
 
+        if (options.configroot is not None
+            and
+            options.configroot.environment is not None
+            ):
+            for k, v in options.configroot.environment.mapping.items():
+                os.environ[k] = v
+
     def emptyline(self):
         # We don't want a blank line to repeat the last command.
         # Showing status is a nice alternative.



More information about the Zope-Checkins mailing list