[Zope-Checkins] SVN: Zope/trunk/ Added an optional explicit argument to the mkzopeinstance script, which allows to specify the Python interpreter to use for the instance. Updated the installation docs with this and note how to create an instance directly from the Zope SVN checkout

Hanno Schlichting plone at hannosch.info
Tue Feb 24 17:58:20 EST 2009


Log message for revision 97227:
  Added an optional explicit argument to the mkzopeinstance script, which allows to specify the Python interpreter to use for the instance. Updated the installation docs with this and note how to create an instance directly from the Zope SVN checkout
  

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

-=-
Modified: Zope/trunk/doc/INSTALL.rst
===================================================================
--- Zope/trunk/doc/INSTALL.rst	2009-02-24 22:34:12 UTC (rev 97226)
+++ Zope/trunk/doc/INSTALL.rst	2009-02-24 22:58:20 UTC (rev 97227)
@@ -59,16 +59,19 @@
 Creating a Zope Instance
 ------------------------
 
-XXX:  Make this not a lie!
-
 Once you've performed the install step, to begin actually using
 Zope, you will need to create an "instance home", which is a
 directory that contains configuration and data for a Zope server
 process.  The instance home is created using the ``mkzopeinstance``
 script::
 
-  $ /bin/mkzopeinstance
+  $ bin/mkzopeinstance
 
+If you use Zope from SVN, you will need to specify the Python interpreter
+to use for the instance explicitly::
+
+  $ bin/mkzopeinstance --python=bin/zopepy
+
 You will be asked to provide a user name and password for an
 administrator's account during ``mkzopeinstance``.  To see the available
 command-line options, run the script with the ``--help`` option::

Modified: Zope/trunk/src/Zope2/utilities/mkzopeinstance.py
===================================================================
--- Zope/trunk/src/Zope2/utilities/mkzopeinstance.py	2009-02-24 22:34:12 UTC (rev 97226)
+++ Zope/trunk/src/Zope2/utilities/mkzopeinstance.py	2009-02-24 22:58:20 UTC (rev 97227)
@@ -22,6 +22,7 @@
 -d/--dir  -- the dir in which the instance home should be created
 -u/--user NAME:PASSWORD -- set the user name and password of the initial user
 -s/--skelsrc -- the dir from which skeleton files should be copied
+-p/--python -- the Python interpreter to use
 
 When run without arguments, this script will ask for the information necessary
 to create a Zope instance home.
@@ -35,8 +36,8 @@
 def main():
     try:
         opts, args = getopt.getopt(sys.argv[1:],
-            "hu:d:s:",
-            ["help", "user=", "dir=", "skelsrc="]
+            "hu:d:s:p:",
+            ["help", "user=", "dir=", "skelsrc=", "python="]
             )
     except getopt.GetoptError, msg:
         usage(sys.stderr, msg)
@@ -47,6 +48,7 @@
     password = None
     skeltarget = None
     skelsrc = None
+    python = None
 
     for opt, arg in opts:
         if opt in ("-d", "--dir"):
@@ -59,6 +61,11 @@
             if not skelsrc:
                 usage(sys.stderr, "skelsrc must not be empty")
                 sys.exit(2)
+        if opt in ("-p", "--python"):
+            python = os.path.abspath(os.path.expanduser(arg))
+            if not os.path.exists(python) and os.path.isfile(python):
+                usage(sys.stderr, "The Python interpreter does not exist.")
+                sys.exit(2)
         if opt in ("-h", "--help"):
             usage(sys.stdout)
             sys.exit()
@@ -95,20 +102,23 @@
     # installer).  Thus, sys.executable may not be the executable we use.
     # We still provide both PYTHON and PYTHONW, but PYTHONW should never
     # need be used.
-    psplit = os.path.split(sys.executable)
+    if python is None:
+        python = sys.executable
+    
+    psplit = os.path.split(python)
     exedir = os.path.join(*psplit[:-1])
     pythonexe = os.path.join(exedir, 'python.exe')
     pythonwexe = os.path.join(exedir, 'pythonw.exe')
 
     if ( os.path.isfile(pythonwexe) and os.path.isfile(pythonexe) and
-         (sys.executable in [pythonwexe, pythonexe]) ):
+         (python in [pythonwexe, pythonexe]) ):
         # we're using a Windows build with both python.exe and pythonw.exe
         # in the same directory
         PYTHON = pythonexe
         PYTHONW = pythonwexe
     else:
         # we're on UNIX or we have a nonstandard Windows setup
-        PYTHON = PYTHONW = sys.executable
+        PYTHON = PYTHONW = python
 
     import Zope2
     zope2path = os.path.realpath(os.path.dirname(Zope2.__file__))



More information about the Zope-Checkins mailing list