[CalendarServer-changes] [7344] CalendarServer/branches/users/glyph/oracle-nulls/calendarserver/tap/ caldav.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Apr 21 09:52:43 PDT 2011


Revision: 7344
          http://trac.macosforge.org/projects/calendarserver/changeset/7344
Author:   glyph at apple.com
Date:     2011-04-21 09:52:43 -0700 (Thu, 21 Apr 2011)
Log Message:
-----------
move parent-environment calculation to a function, add ORACLE_HOME to it

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/oracle-nulls/calendarserver/tap/caldav.py

Modified: CalendarServer/branches/users/glyph/oracle-nulls/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/oracle-nulls/calendarserver/tap/caldav.py	2011-04-21 16:52:34 UTC (rev 7343)
+++ CalendarServer/branches/users/glyph/oracle-nulls/calendarserver/tap/caldav.py	2011-04-21 16:52:43 UTC (rev 7344)
@@ -120,16 +120,35 @@
     return (uid, gid)
 
 
-PARENT_ENVIRONMENT = {
-    "PATH": os.environ.get("PATH", ""),
-    "PYTHONPATH": os.environ.get("PYTHONPATH", ""),
-    "LD_LIBRARY_PATH": os.environ.get("LD_LIBRARY_PATH", ""),
-    "DYLD_LIBRARY_PATH": os.environ.get("DYLD_LIBRARY_PATH", ""),
-}
 
-if "KRB5_KTNAME" in os.environ:
-    PARENT_ENVIRONMENT["KRB5_KTNAME"] = os.environ["KRB5_KTNAME"]
+def _computeEnvVars(parent):
+    """
+    Compute environment variables to be propagated to child processes.
+    """
+    result = {}
+    requiredVars = [
+        "PATH",
+        "PYTHONPATH",
+        "LD_LIBRARY_PATH",
+        "DYLD_LIBRARY_PATH",
+    ]
 
+    optionalVars = [
+        "KRB5_KTNAME",
+        "ORACLE_HOME",
+    ]
+
+    for varname in requiredVars:
+        result[varname] = parent.get(varname, "")
+    for varname in optionalVars:
+        if varname in parent:
+            result[varname] = parent[varname]
+    return result
+
+PARENT_ENVIRONMENT = _computeEnvVars(os.environ)
+
+
+
 class CalDAVStatisticsProtocol (Protocol):
 
     def connectionMade(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110421/461ec782/attachment.html>


More information about the calendarserver-changes mailing list