Commit 94a95f8e authored by Richard Jones's avatar Richard Jones

I've fixed the various scripts etc. in the CVS so that I can now install a ZEO...

I've fixed the various scripts etc. in the CVS so that I can now install a ZEO client/server setup. The way it actually ended up working is:

- runzope.py and zopectl.py are moved to Zope/Startup/run.py and Zope/zdaemon/zopectl.py respectively
- bin/mkzopeinstance now takes a "-z/--zeo host:port" which sets up a custom_zodb.py in the new zope instance home
- bin/mkzeoinstance now overrides less, because...
- ZEO/mkzeoinst.py generates an additional script, runzeo, which is the "runner" for the ZEO server. Both it an the zeoctl script need to know about the ZOPE_HOME, so that's been added to the scripts (via the params)
- fixed setup.py so it installed ZEO/schema.xml
parent 7d4a92f6
......@@ -20,22 +20,9 @@ zopehome = os.path.dirname(mydir)
softwarehome = os.path.join(zopehome, "lib", "python")
if softwarehome not in sys.path:
sys.path.append(softwarehome)
sys.path.insert(0, softwarehome)
from ZEO.mkzeoinst import ZEOInstanceBuilder
class InstanceBuilder(ZEOInstanceBuilder):
def get_params(self, home, port):
return {
"package": "zeo",
"PACKAGE": "ZEO",
"home": home,
"port": port,
"python": sys.executable,
"server": os.path.join(softwarehome, "ZEO", "runzeo.py"),
"zdrun": os.path.join(softwarehome, "zdaemon", "zdrun.py"),
"zdctl": os.path.join(softwarehome, "zdaemon", "zdctl.py"),
}
if __name__ == "__main__":
InstanceBuilder().run()
ZEOInstanceBuilder().run()
......@@ -20,6 +20,7 @@ Options:
-h/--help -- print this help text
-u/--user NAME:PASSWORD -- set the user name and password of the initial user
-z/--zeo host:port -- set the host:port of the ZEO server
"""
import getopt
......@@ -29,12 +30,14 @@ import sys
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hu:", ["help", "user="])
opts, args = getopt.getopt(sys.argv[1:], "hu:z:", ["help", "user=",
"zeo="])
except getopt.GetoptError, msg:
usage(sys.stderr, msg)
sys.exit(2)
user = None
password = None
zeo = None
for opt, arg in opts:
if opt in ("-h", "--help"):
usage(sys.stdout)
......@@ -44,6 +47,16 @@ def main():
usage(sys.stderr, "user must be specified as name:password")
sys.exit(2)
user, password = arg.split(":", 1)
if opt in ("-z", "--zeo"):
if not ":" in arg:
usage(sys.stderr, "zeo server must be specified as host:port")
sys.exit(2)
zeo = tuple(arg.split(":", 1))
try:
int(zeo[1])
except ValueError:
usage(sys.stderr, "zeo server port must be a number")
sys.exit(2)
if len(args) != 1:
usage(sys.stderr, "mkzopeinstance requires exactly one argument")
sys.exit(2)
......@@ -52,6 +65,8 @@ def main():
if not (user or os.path.exists(inituser)):
user, password = get_inituser()
makeinstance(dirname, user, password, inituser)
if zeo:
makezeo(dirname, zeo)
def usage(stream, msg=None):
if msg:
......@@ -112,6 +127,12 @@ def makeinstance(dirname, user, password, inituser):
if user:
write_inituser(inituser, user, password)
def makezeo(dirname, zeo):
fp = open(os.path.join(dirname, 'custom_zodb.py'), 'w')
print >>fp, "import ZEO.ClientStorage"
print >>fp, "Storage=ZEO.ClientStorage.ClientStorage(('%s',%s))"%zeo
fp.close()
def write_inituser(fn, user, password):
import binascii
import sha
......
......@@ -273,3 +273,5 @@ def do_locale(locale_id):
'See your operating system documentation for more\n'
'information on locale support.' % locale_id
)
......@@ -632,7 +632,7 @@ setup(
author=AUTHOR,
packages=['ZEO', 'ZEO.tests', 'ZEO.zrpc'],
data_files=[['ZEO', ['ZEO/*.txt', 'ZEO/component.xml']]],
data_files=[['ZEO', ['ZEO/*.txt', 'ZEO/*.xml']]],
)
# ZConfig
......@@ -1057,8 +1057,7 @@ distutils.core.setup(
author=AUTHOR,
data_files=installed_data_files,
scripts=["bin/runzope.py", "bin/zopectl.py",
"bin/mkzeoinstance", "bin/mkzopeinstance"],
scripts=["bin/mkzeoinstance", "bin/mkzopeinstance"],
distclass=ZopeDistribution,
)
......@@ -9,4 +9,6 @@ CONFIG_FILE="$INSTANCE_HOME/etc/zope.conf"
PYTHONPATH="$ZOPE_HOME/lib/python"
export PYTHONPATH
exec "$PYTHON" "$ZOPE_HOME/bin/runzope.py" -C "$CONFIG_FILE" "$@"
ZOPE_RUN="$ZOPE_HOME/lib/python/Zope/Startup/run.py"
exec "$PYTHON" "$ZOPE_RUN" -C "$CONFIG_FILE" "$@"
......@@ -9,6 +9,6 @@ CONFIG_FILE="$INSTANCE_HOME/etc/zope.conf"
PYTHONPATH="$ZOPE_HOME/lib/python"
export PYTHONPATH
ZDCTL="$ZOPE_HOME/bin/zopectl.py"
ZDCTL="$ZOPE_HOME/lib/python/Zope/Startup/zopectl.py"
exec "$PYTHON" "$ZDCTL" -C "$CONFIG_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