[Checkins] SVN: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py Better support for virtualenv and windows.

Jan-Jaap Driessen jdriessen at thehealthagency.com
Thu Dec 16 17:50:28 EST 2010


Log message for revision 118975:
  Better support for virtualenv and windows.

Changed:
  U   z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py

-=-
Modified: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py
===================================================================
--- z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py	2010-12-16 21:47:58 UTC (rev 118974)
+++ z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/runner.py	2010-12-16 22:50:28 UTC (rev 118975)
@@ -5,6 +5,7 @@
 import time
 import pickle
 
+from zc.buildout.easy_install import _has_broken_dash_S
 
 def usage():
     print """
@@ -21,8 +22,6 @@
 
     def __init__(self, script, args):
         self.script = script
-        if windoze:
-            self.script += '-script.py'
         self.args = args
         self.name = os.path.basename(script)
         self.output = StringIO.StringIO()
@@ -30,8 +29,18 @@
 
     def start(self):
         self.start = time.time()
+
+        cmd = [self.script]
+        # We are dealing with two problems: windoze and virtualenv.
+        if windoze:
+            # Use zc.buildout internal to sniff a virtualenv.
+            if _has_broken_dash_S(sys.executable):
+                cmd = [sys.executable, self.script + '-script.py']
+            else:
+                cmd = [self.script + '.exe']
+
         self.process = subprocess.Popen(
-            [sys.executable, self.script, '--exit-with-status'] + self.args,
+            cmd + ['--exit-with-status'] + self.args,
             stdin=subprocess.PIPE,
             stdout=subprocess.PIPE,
             stderr=subprocess.STDOUT,



More information about the checkins mailing list