[Checkins] SVN: zc.buildout/trunk/ Fixed windows problems

Jim Fulton jim at zope.com
Thu Sep 14 07:24:46 EDT 2006


Log message for revision 70170:
  Fixed windows problems

Changed:
  U   zc.buildout/trunk/src/zc/buildout/buildout.py
  U   zc.buildout/trunk/src/zc/buildout/tests.py
  U   zc.buildout/trunk/zc.recipe.testrunner/src/zc/recipe/testrunner/tests.py

-=-
Modified: zc.buildout/trunk/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/buildout.py	2006-09-14 11:11:38 UTC (rev 70169)
+++ zc.buildout/trunk/src/zc/buildout/buildout.py	2006-09-14 11:24:45 UTC (rev 70170)
@@ -66,9 +66,10 @@
 
 class Buildout(dict):
 
-    def __init__(self, config_file, cloptions):
+    def __init__(self, config_file, cloptions, windows_restart=False):
         config_file = os.path.abspath(config_file)
         self._config_file = config_file
+        self.__windows_restart = windows_restart
         if not os.path.exists(config_file):
             print 'Warning: creating', config_file
             open(config_file, 'w').write('[buildout]\nparts = \n')
@@ -567,6 +568,14 @@
 
         if not upgraded:
             return
+
+        if sys.platform == 'win32' and not self.__windows_restart:
+            args = map(zc.buildout.easy_install._safe_arg, sys.argv)
+            args.insert(1, '-W')
+            if not __debug__:
+                args.insert(0, '-O')
+            args.insert(0, sys.executable)
+            os.execv(sys.executable, args)            
         
         self._logger.info("Upgraded:\n  %s;\nrestarting.",
                           ",\n  ".join([("%s version %s"
@@ -784,15 +793,18 @@
     config_file = 'buildout.cfg'
     verbosity = 0
     options = []
+    windows_restart = False
     while args:
         if args[0][0] == '-':
             op = orig_op = args.pop(0)
             op = op[1:]
-            while op and op[0] in 'vqh':
+            while op and op[0] in 'vqhW':
                 if op[0] == 'v':
                     verbosity += 10
                 elif op[0] == 'q':
                     verbosity -= 10
+                elif op[0] == 'W':
+                    windows_restart = True
                 else:
                     _help()
                 op = op[1:]
@@ -833,7 +845,7 @@
 
     try:
         try:
-            buildout = Buildout(config_file, options)
+            buildout = Buildout(config_file, options, windows_restart)
             getattr(buildout, command)(args)
         except zc.buildout.UserError, v:
             _error(str(v))

Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py	2006-09-14 11:11:38 UTC (rev 70169)
+++ zc.buildout/trunk/src/zc/buildout/tests.py	2006-09-14 11:24:45 UTC (rev 70170)
@@ -522,6 +522,7 @@
                (re.compile('#!\S+python\S*'), '#!python'),
                (re.compile('\S+sample-(\w+)'), r'/sample-\1'),
                (re.compile('-py\d[.]\d.egg'), r'-py2.3.egg'),
+               (re.compile(r'\\+'), '/'),
                ])
             ),
         
@@ -559,6 +560,8 @@
                 'setuptools.egg'),
                (re.compile('zc.buildout-\S+-py\d.\d.egg'),
                 'zc.buildout.egg'),
+               (re.compile('(\n?)-  ([a-zA-Z_.-]+)-script.py\n-  \\2.exe\n'),
+                '\\1-  \\2\n'),
                ]),
             )
         ))

Modified: zc.buildout/trunk/zc.recipe.testrunner/src/zc/recipe/testrunner/tests.py
===================================================================
--- zc.buildout/trunk/zc.recipe.testrunner/src/zc/recipe/testrunner/tests.py	2006-09-14 11:11:38 UTC (rev 70169)
+++ zc.buildout/trunk/zc.recipe.testrunner/src/zc/recipe/testrunner/tests.py	2006-09-14 11:24:45 UTC (rev 70170)
@@ -57,6 +57,7 @@
                (re.compile('#!\S+python\S*'), '#!python'),
                (re.compile('\S+sample-(\w+)'), r'/sample-\1'),
                (re.compile('-([^-]+)-py\d[.]\d.egg'), r'-py2.3.egg'),
+               (re.compile(r'\\+'), '/'),
                ])
             ),
         



More information about the Checkins mailing list