[Zope-Checkins] CVS: Zope/bin - mkzeoinstance:1.4 mkzopeinstance:1.3

Richard Jones rjones@ekit-inc.com
Fri, 4 Apr 2003 00:04:18 -0500


Update of /cvs-repository/Zope/bin
In directory cvs.zope.org:/tmp/cvs-serv1086/bin

Modified Files:
	mkzeoinstance mkzopeinstance 
Log Message:
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



=== Zope/bin/mkzeoinstance 1.3 => 1.4 ===
--- Zope/bin/mkzeoinstance:1.3	Thu Apr  3 02:11:03 2003
+++ Zope/bin/mkzeoinstance	Fri Apr  4 00:03:47 2003
@@ -20,22 +20,9 @@
 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()


=== Zope/bin/mkzopeinstance 1.2 => 1.3 ===
--- Zope/bin/mkzopeinstance:1.2	Tue Mar 18 16:27:49 2003
+++ Zope/bin/mkzopeinstance	Fri Apr  4 00:03:47 2003
@@ -20,6 +20,7 @@
 
 -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 @@
 
 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 @@
                 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 @@
     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:
@@ -111,6 +126,12 @@
 
     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