[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/server/ when creating an instance using a specified skeleton, do not copy in the

Fred L. Drake, Jr. fdrake at gmail.com
Thu Feb 3 11:34:52 EST 2005


Log message for revision 29028:
  when creating an instance using a specified skeleton, do not copy in the
  package-includes from the checkout
  

Changed:
  U   Zope3/trunk/src/zope/app/server/mkzopeinstance.py
  U   Zope3/trunk/src/zope/app/server/tests/test_mkzopeinstance.py

-=-
Modified: Zope3/trunk/src/zope/app/server/mkzopeinstance.py
===================================================================
--- Zope3/trunk/src/zope/app/server/mkzopeinstance.py	2005-02-03 11:19:45 UTC (rev 29027)
+++ Zope3/trunk/src/zope/app/server/mkzopeinstance.py	2005-02-03 16:34:52 UTC (rev 29028)
@@ -37,13 +37,12 @@
     if argv is None:
         argv = sys.argv
     try:
-        options = parse_args(argv)
+        options = parse_args(argv, from_checkout)
     except SystemExit, e:
         if e.code:
             return 2
         else:
             return 0
-    options.from_checkout = from_checkout
     app = Application(options)
     try:
         return app.process()
@@ -106,7 +105,7 @@
 
         # now create the instance!
         self.copy_skeleton()
-        if options.from_checkout:
+        if options.add_package_includes:
             # need to copy ZCML differently since it's not in the skeleton:
             import __main__
             swhome = os.path.dirname(
@@ -231,12 +230,9 @@
 """
 
 
-def parse_args(argv):
+def parse_args(argv, from_checkout=False):
     """Parse the command line, returning an object representing the input."""
     path, prog = os.path.split(os.path.realpath(argv[0]))
-    basedir = os.path.dirname(path)
-    # no assurance that this exists!
-    default_skeleton = os.path.join(basedir, "zopeskel")
     version = "%prog for " + zopeversion.ZopeVersionUtility.getZopeVersion()
     p = optparse.OptionParser(prog=prog,
                               usage="%prog [options]",
@@ -244,12 +240,17 @@
     p.add_option("-d", "--dir", dest="destination", metavar="DIR",
                  help="the dir in which the instance home should be created")
     p.add_option("-s", "--skelsrc", dest="skeleton", metavar="DIR",
-                 default=default_skeleton,
                  help="template skeleton directory")
     p.add_option("-u", "--user", dest="username", metavar="USER:PASSWORD",
                  help="set the user name and password of the initial user")
     options, args = p.parse_args(argv[1:])
-    options.from_checkout = False
+    if options.skeleton is None:
+        options.add_package_includes = from_checkout
+        basedir = os.path.dirname(path)
+        # no assurance that this exists!
+        options.skeleton = os.path.join(basedir, "zopeskel")
+    else:
+        options.add_package_includes = False
     options.program = prog
     options.version = version
     if args:

Modified: Zope3/trunk/src/zope/app/server/tests/test_mkzopeinstance.py
===================================================================
--- Zope3/trunk/src/zope/app/server/tests/test_mkzopeinstance.py	2005-02-03 11:19:45 UTC (rev 29027)
+++ Zope3/trunk/src/zope/app/server/tests/test_mkzopeinstance.py	2005-02-03 16:34:52 UTC (rev 29028)
@@ -96,10 +96,12 @@
     def test_with_skeleton_long(self):
         options = self.parse_args(["--skelsrc", "some/dir"])
         self.assertEqual(options.skeleton, "some/dir")
+        self.failIf(options.add_package_includes)
 
     def test_with_skeleton_short(self):
         options = self.parse_args(["-s", "some/dir"])
         self.assertEqual(options.skeleton, "some/dir")
+        self.failIf(options.add_package_includes)
 
     def test_without_username(self):
         options = self.parse_args([])
@@ -280,7 +282,7 @@
     destination = None
     version = "[test-version]"
     program = "[test-program]"
-    from_checkout = False
+    add_package_includes = False
 
 
 def test_suite():



More information about the Zope3-Checkins mailing list