Commit 4c3c975b authored by Hanno Schlichting's avatar Hanno Schlichting

Removed the specification of `SOFTWARE_HOME` and `ZOPE_HOME` from the standard instance scripts.

parent 909c3558
...@@ -23,6 +23,10 @@ Known issues ...@@ -23,6 +23,10 @@ Known issues
Restructuring Restructuring
+++++++++++++ +++++++++++++
- Removed the specification of `SOFTWARE_HOME` and `ZOPE_HOME` from the
standard instance scripts.
[hannosch]
- Made the specification of `SOFTWARE_HOME` and `ZOPE_HOME` optional. In - Made the specification of `SOFTWARE_HOME` and `ZOPE_HOME` optional. In
addition `INSTANCE_HOME` is no longer required to run the tests of a addition `INSTANCE_HOME` is no longer required to run the tests of a
source checkout of Zope. source checkout of Zope.
......
...@@ -29,7 +29,6 @@ to create a Zope instance home. ...@@ -29,7 +29,6 @@ to create a Zope instance home.
import getopt import getopt
import os import os
import shutil
import sys import sys
import copyzopeskel import copyzopeskel
...@@ -81,8 +80,6 @@ def main(): ...@@ -81,8 +80,6 @@ def main():
) )
instancehome = skeltarget instancehome = skeltarget
zopehome = os.path.dirname(os.path.dirname(script))
softwarehome = os.path.join(zopehome, "src")
configfile = os.path.join(instancehome, 'etc', 'zope.conf') configfile = os.path.join(instancehome, 'etc', 'zope.conf')
if skelsrc is None: if skelsrc is None:
# default to using stock Zope skeleton source # default to using stock Zope skeleton source
...@@ -113,12 +110,14 @@ def main(): ...@@ -113,12 +110,14 @@ def main():
# we're on UNIX or we have a nonstandard Windows setup # we're on UNIX or we have a nonstandard Windows setup
PYTHON = PYTHONW = sys.executable PYTHON = PYTHONW = sys.executable
import Zope2
zope2path = os.path.realpath(os.path.dirname(Zope2.__file__))
kw = { kw = {
"PYTHON":PYTHON, "PYTHON":PYTHON,
"PYTHONW":PYTHONW, "PYTHONW":PYTHONW,
"INSTANCE_HOME": instancehome, "INSTANCE_HOME": instancehome,
"SOFTWARE_HOME": softwarehome, "ZOPE2PATH": zope2path,
"ZOPE_HOME": zopehome,
} }
copyzopeskel.copyskel(skelsrc, skeltarget, None, None, **kw) copyzopeskel.copyskel(skelsrc, skeltarget, None, None, **kw)
......
@set ZOPE_HOME=<<ZOPE_HOME>> @set PYTHON=<<PYTHON>>
@set INSTANCE_HOME=<<INSTANCE_HOME>> @set INSTANCE_HOME=<<INSTANCE_HOME>>
@set PYTHON=%ZOPE_HOME%\bin\python.exe
@set SOFTWARE_HOME=%ZOPE_HOME%\lib\python
@set CONFIG_FILE=%INSTANCE_HOME%\etc\zope.conf @set CONFIG_FILE=%INSTANCE_HOME%\etc\zope.conf
@set PYTHONPATH=%SOFTWARE_HOME% @set ZOPE_RUN=<<ZOPE2PATH>>\Zope2\Startup\run.py
@set ZOPE_RUN=%SOFTWARE_HOME%\Zope2\Startup\run.py
"%PYTHON%" "%ZOPE_RUN%" -C "%CONFIG_FILE%" %1 %2 %3 %4 %5 %6 %7 "%PYTHON%" "%ZOPE_RUN%" -C "%CONFIG_FILE%" %1 %2 %3 %4 %5 %6 %7
#! /bin/sh #! /bin/sh
PYTHON="<<PYTHON>>" PYTHON="<<PYTHON>>"
ZOPE_HOME="<<ZOPE_HOME>>"
INSTANCE_HOME="<<INSTANCE_HOME>>" INSTANCE_HOME="<<INSTANCE_HOME>>"
CONFIG_FILE="<<INSTANCE_HOME>>/etc/zope.conf" CONFIG_FILE="<<INSTANCE_HOME>>/etc/zope.conf"
SOFTWARE_HOME="<<SOFTWARE_HOME>>" export INSTANCE_HOME
PYTHONPATH="$SOFTWARE_HOME:$PYTHONPATH"
export PYTHONPATH INSTANCE_HOME SOFTWARE_HOME
ZOPE2PATH=`${PYTHON} -c "import os, Zope2; print os.path.dirname(Zope2.__file__)" ` ZOPE_RUN="<<ZOPE2PATH>>/Startup/run.py"
ZOPE_RUN="$ZOPE2PATH/Startup/run.py"
exec "$PYTHON" "$ZOPE_RUN" -C "$CONFIG_FILE" "$@" exec "$PYTHON" "$ZOPE_RUN" -C "$CONFIG_FILE" "$@"
@set ZOPE_HOME=<<ZOPE_HOME>> @set PYTHON=<<PYTHON>>
@set INSTANCE_HOME=<<INSTANCE_HOME>> @set INSTANCE_HOME=<<INSTANCE_HOME>>
@set PYTHON=%ZOPE_HOME%\bin\python.exe
@set SOFTWARE_HOME=%ZOPE_HOME%\lib\python
@set CONFIG_FILE=%INSTANCE_HOME%\etc\zope.conf @set CONFIG_FILE=%INSTANCE_HOME%\etc\zope.conf
@set PYTHONPATH=%SOFTWARE_HOME% @set ZDCTL=<<ZOPE2PATH>>\Zope2\Startup\zopectl.py
@set ZDCTL=%SOFTWARE_HOME%\Zope2\Startup\zopectl.py
"%PYTHON%" "%ZDCTL%" -C "%CONFIG_FILE%" %1 %2 %3 %4 %5 %6 %7 "%PYTHON%" "%ZDCTL%" -C "%CONFIG_FILE%" %1 %2 %3 %4 %5 %6 %7
#! /bin/sh #! /bin/sh
PYTHON="<<PYTHON>>" PYTHON="<<PYTHON>>"
ZOPE_HOME="<<ZOPE_HOME>>"
INSTANCE_HOME="<<INSTANCE_HOME>>" INSTANCE_HOME="<<INSTANCE_HOME>>"
CONFIG_FILE="<<INSTANCE_HOME>>/etc/zope.conf" CONFIG_FILE="<<INSTANCE_HOME>>/etc/zope.conf"
SOFTWARE_HOME="<<SOFTWARE_HOME>>" export INSTANCE_HOME
PYTHONPATH="$SOFTWARE_HOME:$PYTHONPATH"
export PYTHONPATH INSTANCE_HOME SOFTWARE_HOME
ZOPE2PATH=`${PYTHON} -c "import os, Zope2; print os.path.dirname(Zope2.__file__)" ` ZDCTL="<<ZOPE2PATH>>/Startup/zopectl.py"
ZDCTL="$ZOPE2PATH/Startup/zopectl.py"
exec "$PYTHON" "$ZDCTL" -C "$CONFIG_FILE" "$@" exec "$PYTHON" "$ZDCTL" -C "$CONFIG_FILE" "$@"
...@@ -82,33 +82,14 @@ import sys, os ...@@ -82,33 +82,14 @@ import sys, os
# these are replacements from mkzopeinstance # these are replacements from mkzopeinstance
PYTHON = r'<<PYTHON>>' PYTHON = r'<<PYTHON>>'
SOFTWARE_HOME=r'<<SOFTWARE_HOME>>'
INSTANCE_HOME = r'<<INSTANCE_HOME>>' INSTANCE_HOME = r'<<INSTANCE_HOME>>'
ZOPE_HOME = r'<<ZOPE_HOME>>'
ZOPE_RUN = r'%s\Zope2\Startup\run.py' % SOFTWARE_HOME ZOPE_RUN = r'<<ZOPE2PATH>>\Zope2\Startup\run.py'
CONFIG_FILE= os.path.join(INSTANCE_HOME, 'etc', 'zope.conf') CONFIG_FILE= os.path.join(INSTANCE_HOME, 'etc', 'zope.conf')
PYTHONSERVICE_EXE=r'%s\bin\PythonService.exe' % ZOPE_HOME PYTHONSERVICE_EXE=r'%s\bin\PythonService.exe' % ZOPE_HOME
# Setup the environment, so sub-processes see these variables
for check_dir in (os.path.join(SOFTWARE_HOME, 'third_party', 'docutils', 'extras'),
os.path.join(SOFTWARE_HOME, 'third_party', 'docutils'),
SOFTWARE_HOME,
):
parts = os.environ.get("PYTHONPATH", "").split(os.pathsep)
if check_dir not in parts:
parts = filter(None, [check_dir] + parts)
os.environ["PYTHONPATH"] = os.pathsep.join(parts)
os.environ["INSTANCE_HOME"] = INSTANCE_HOME os.environ["INSTANCE_HOME"] = INSTANCE_HOME
# Ensure SOFTWARE_HOME is on our current sys.path so we can import the
# nt_svcutils package. Note we don't need the docutils dirs in sys.path, as
# only Zope itself (our child process) uses it, and that happens via
# PYTHONPATH
if SOFTWARE_HOME not in sys.path:
sys.path.insert(0, SOFTWARE_HOME)
from nt_svcutils.service import Service from nt_svcutils.service import Service
servicename = 'Zope_%s' % str(hash(INSTANCE_HOME.lower())) servicename = 'Zope_%s' % str(hash(INSTANCE_HOME.lower()))
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
# ZConfig "defines" used for later textual substitution # ZConfig "defines" used for later textual substitution
%define INSTANCE <<INSTANCE_HOME>> %define INSTANCE <<INSTANCE_HOME>>
%define ZOPE <<ZOPE_HOME>>
# Directive: instancehome # Directive: instancehome
# #
......
...@@ -372,5 +372,5 @@ class Service(win32serviceutil.ServiceFramework): ...@@ -372,5 +372,5 @@ class Service(win32serviceutil.ServiceFramework):
# Real __main__ bootstrap code is in the instance's service module. # Real __main__ bootstrap code is in the instance's service module.
if __name__ == '__main__': if __name__ == '__main__':
print "This is a framework module - you don't run it directly." print "This is a framework module - you don't run it directly."
print "See your $SOFTWARE_HOME\bin directory for the service script." print "See your installation directory for the service script."
sys.exit(1) sys.exit(1)
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