Skip to content

Commit

Permalink
Better support for virtualenv and windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
janjaapdriessen committed Dec 16, 2010
1 parent a7e7273 commit bf1265d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/z3c/recipe/compattest/runner.py
Expand Up @@ -5,6 +5,7 @@
import time
import pickle

from zc.buildout.easy_install import _has_broken_dash_S

def usage():
print """
Expand All @@ -21,17 +22,25 @@ class Job(object):

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()
self.exitcode = None

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,
Expand Down

0 comments on commit bf1265d

Please sign in to comment.