Commit a166684b authored by Hanno Schlichting's avatar Hanno Schlichting

Added an optional explicit argument to the mkzopeinstance script, which allows...

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
parent f0c45600
......@@ -59,15 +59,18 @@ This will create the related scripts like ``mkzopeinstance`` within the
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
......
......@@ -22,6 +22,7 @@ Options:
-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 @@ import copyzopeskel
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 @@ def main():
password = None
skeltarget = None
skelsrc = None
python = None
for opt, arg in opts:
if opt in ("-d", "--dir"):
......@@ -59,6 +61,11 @@ def main():
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 @@ def main():
# 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__))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment