Attempt with subprocess instead

This commit is contained in:
Anthony Sottile
2014-03-14 00:04:15 -07:00
parent 4db38596c8
commit 0f14d4c072

View File

@@ -1,5 +1,6 @@
from plumbum import local
import subprocess
PY_ENV = 'py_env'
@@ -7,7 +8,7 @@ PY_ENV = 'py_env'
def install_environment():
assert local.path('setup.py').exists()
# Return immediately if we already have a virtualenv
if local.path('py_env').exists():
if local.path(PY_ENV).exists():
return
# Install a virtualenv
@@ -17,6 +18,17 @@ def install_environment():
def run_hook(hook, file_args):
# TODO: batch filenames
process = subprocess.Popen(
['bash', '-c', ' '.join(
['source {0}/bin/activate &&'.format(PY_ENV)] +
[hook['entry']] + hook.get('args', []) + list(file_args)
)],
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
)
ret = process.communicate()
return (0,) + ret
return local['bash'][
'-c', ' '.join(
['source {0}/bin/activate &&'.format(PY_ENV)] +