[Zope3-checkins] CVS: Zope3 - z3.py:1.20 principals.zcml.in:NONE

Fred L. Drake, Jr. fred@zope.com
Wed, 25 Jun 2003 11:35:02 -0400


Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv5567

Modified Files:
	z3.py 
Removed Files:
	principals.zcml.in 
Log Message:
Merged from fdrake-zconfig-in-zope-3-branch:
- update the instructions for creating principals.zcml
- have z3.py call the support code in zope.app.process


=== Zope3/z3.py 1.19 => 1.20 ===
--- Zope3/z3.py:1.19	Wed Jun 11 16:12:32 2003
+++ Zope3/z3.py	Wed Jun 25 11:35:02 2003
@@ -17,93 +17,42 @@
 $Id$
 """
 
-import os, sys, time, getopt
+import os
+import sys
 
-basepath = filter(None, sys.path)
 
-def run(argv=sys.argv):
+basepath = filter(None, sys.path)
 
-    
-    
-    # Record start times (real time and CPU time)
-    t0 = time.time()
-    c0 = time.clock()
+def run(argv=list(sys.argv)):
 
     # Refuse to run without principals.zcml
     if not os.path.exists('principals.zcml'):
-        print """ERROR: You need to create principals.zcml
+        print """\
+        ERROR: You need to create principals.zcml
 
         The file principals.zcml contains your "bootstrap" user
         database. You aren't going to get very far without it.  Start
-        by copying principals.zcml.in and then look at
-        sample_principals.zcml for some example principal and role
-        settings."""
+        by copying sample_principals.zcml and then modify the
+        example principal and role settings.
+        """
         sys.exit(1)
 
     # setting python paths
-    program = argv.pop(0)
-    if argv == ['--build']:
+    program = argv[0]
+    if "--build" in argv:
+        argv.remove("--build")
         from distutils.util import get_platform
         PLAT_SPEC = "%s-%s" % (get_platform(), sys.version[0:3])
         src = os.path.join("build", "lib.%s" % PLAT_SPEC)
     else:
-        src='src'
+        src = 'src'
 
-    
-    here = os.path.join(os.getcwd(), os.path.split(program)[0])
+    here = os.path.dirname(os.path.abspath(program))
     srcdir = os.path.abspath(src)
     sys.path = [srcdir, here] + basepath
 
-    # Initialize the logging module.
-    import logging.config
-    logging.basicConfig()
-    # See zope/app/startup/sitedefinition.py for this default:
-    logging.root.setLevel(logging.INFO)
-    # If log.ini exists, use it
-    if os.path.exists("log.ini"):
-        logging.config.fileConfig("log.ini")
-
-    # temp hack
-    dir = os.getcwd()
-
-    # Copy products.zcml.in, if necessary
-    if (not os.path.exists('products.zcml')
-        and os.path.exists('products.zcml.in')
-        ):
-        cfin = open('products.zcml.in')
-        cfout = open('products.zcml', 'w')
-        cfout.write(cfin.read())
-        cfout.close(); cfin.close()
-
-    # Do global software config
-    from zope.app import config
-    config('site.zcml')
-
-    # Load server config
-    if (not os.path.exists('zserver.zcml')
-        and os.path.exists('zserver.zcml.in')
-        ):
-        cfin = open('zserver.zcml.in')
-        cfout = open('zserver.zcml', 'w')
-        cfout.write(cfin.read())
-        cfout.close(); cfin.close()
-
-    from zope.configuration.xmlconfig import XMLConfig
-    XMLConfig(os.path.join(dir, 'zserver.zcml'))()
-
-    from zodb.zeo import threadedasync
-
-    # Report total startup time
-    t1 = time.time()
-    c1 = time.clock()
-    logging.info("Startup time: %.3f sec real, %.3f sec CPU", t1-t0, c1-c0)
-
-    try:
-        threadedasync.loop()
-    except KeyboardInterrupt:
-        # Exit without spewing an exception.
-        pass
-    sys.exit(0)
+    from zope.app.process.main import main
+    main(argv[1:])
 
 
 if __name__ == '__main__':

=== Removed File Zope3/principals.zcml.in ===