[Zope-Checkins] SVN: Zope/trunk/src/Zope2/utilities/mkzopeinstance.py Get the Zope2 path from the selected Python interpreter, which is not

Stefan H. Holek stefan at epy.co.at
Thu Apr 9 10:24:25 EDT 2009


Log message for revision 99032:
  Get the Zope2 path from the selected Python interpreter, which is not
  necessarily the same as the one used to run mkzopeinstance.
  

Changed:
  U   Zope/trunk/src/Zope2/utilities/mkzopeinstance.py

-=-
Modified: Zope/trunk/src/Zope2/utilities/mkzopeinstance.py
===================================================================
--- Zope/trunk/src/Zope2/utilities/mkzopeinstance.py	2009-04-09 12:28:27 UTC (rev 99031)
+++ Zope/trunk/src/Zope2/utilities/mkzopeinstance.py	2009-04-09 14:24:24 UTC (rev 99032)
@@ -123,8 +123,7 @@
         # we're on UNIX or we have a nonstandard Windows setup
         PYTHON = PYTHONW = python
 
-    import Zope2
-    zope2path = os.path.realpath(os.path.dirname(Zope2.__file__))
+    zope2path = get_zope2path(PYTHON)
 
     kw = {
         "PYTHON":PYTHON,
@@ -198,5 +197,15 @@
         parser.read('buildout.cfg')
         return 'zopepy' in parser.sections()
 
+def get_zope2path(python):
+    """ Get Zope2 path from selected Python interpreter.
+    """
+    p = os.popen('"%s" -c"import os, Zope2; '
+                 'print os.path.realpath(os.path.dirname(Zope2.__file__))"' % python)
+    try:
+        return p.readline()[:-1]
+    finally:
+        p.close()
+
 if __name__ == "__main__":
     main()



More information about the Zope-Checkins mailing list