[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/ Make mkzopeinstance work from a Subversion checkout as well as an installation

Fred L. Drake, Jr. fdrake at gmail.com
Mon Sep 13 10:41:02 EDT 2004


Log message for revision 27509:
  Make mkzopeinstance work from a Subversion checkout as well as an installation
  
  (merged from trunk revisions 27478, 27480)
  


Changed:
  U   Zope3/branches/ZopeX3-3.0/bin/mkzopeinstance
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/server/mkzopeinstance.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/server/tests/test_mkzopeinstance.py


-=-
Modified: Zope3/branches/ZopeX3-3.0/bin/mkzopeinstance
===================================================================
--- Zope3/branches/ZopeX3-3.0/bin/mkzopeinstance	2004-09-13 13:41:48 UTC (rev 27508)
+++ Zope3/branches/ZopeX3-3.0/bin/mkzopeinstance	2004-09-13 14:41:01 UTC (rev 27509)
@@ -23,6 +23,8 @@
 here = os.path.dirname(os.path.realpath(__file__))
 swhome = os.path.dirname(here)
 
+from_checkout = os.path.isdir(os.path.join(swhome, ".svn"))
+
 for parts in [("src",), ("lib", "python"), ("Lib", "site-packages")]:
     d = os.path.join(swhome, *(parts + ("zope", "app", "appsetup")))
     if os.path.isdir(d):
@@ -37,4 +39,4 @@
 from zope.app.server.mkzopeinstance import main
 
 
-sys.exit(main())
+sys.exit(main(from_checkout=from_checkout))

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/server/mkzopeinstance.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/server/mkzopeinstance.py	2004-09-13 13:41:48 UTC (rev 27508)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/server/mkzopeinstance.py	2004-09-13 14:41:01 UTC (rev 27509)
@@ -32,7 +32,7 @@
 from zope.app.applicationcontrol import zopeversion
 
 
-def main(argv=None):
+def main(argv=None, from_checkout=False):
     """Top-level script function to create a new Zope instance."""
     if argv is None:
         argv = sys.argv
@@ -43,6 +43,7 @@
             return 2
         else:
             return 0
+    options.from_checkout = from_checkout
     app = Application(options)
     try:
         return app.process()
@@ -105,6 +106,19 @@
 
         # now create the instance!
         self.copy_skeleton()
+        if options.from_checkout:
+            # need to copy ZCML differently since it's not in the skeleton:
+            import __main__
+            swhome = os.path.dirname(
+                os.path.dirname(os.path.realpath(__main__.__file__)))
+            shutil.copy2(os.path.join(swhome, "securitypolicy.zcml"),
+                         os.path.join(options.destination, "etc"))
+            piname = "package-includes"
+            pisrc = os.path.join(swhome, piname)
+            pidst = os.path.join(options.destination, "etc", piname)
+            for fn in os.listdir(pisrc):
+                if fn.endswith(".zcml"):
+                    shutil.copy2(os.path.join(pisrc, fn), pidst)
         return 0
 
     def get_skeltarget(self):
@@ -235,6 +249,7 @@
     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
     options.program = prog
     options.version = version
     if args:

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/server/tests/test_mkzopeinstance.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/server/tests/test_mkzopeinstance.py	2004-09-13 13:41:48 UTC (rev 27508)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/server/tests/test_mkzopeinstance.py	2004-09-13 14:41:01 UTC (rev 27509)
@@ -280,6 +280,7 @@
     destination = None
     version = "[test-version]"
     program = "[test-program]"
+    from_checkout = False
 
 
 def test_suite():



More information about the Zope3-Checkins mailing list