Skip to content

Commit

Permalink
try to bootstrap virtualenv
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Sep 17, 2016
1 parent df2f31f commit 3d20744
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions build.py
Expand Up @@ -13,10 +13,6 @@
# See https://github.com/AspenWeb/pando.py/issues/542
USE_PY_VENV = sys.version_info > (3, 3)

ENV_ARGS = [
'-m', ('venv' if USE_PY_VENV else 'virtualenv')
]


def _virt(cmd, envdir='env'):
envdir = _env(envdir)
Expand Down Expand Up @@ -52,8 +48,17 @@ def __env(envdir):
# We've already built our own virtualenv.
return envdir

args = [sys.executable] + ENV_ARGS + [envdir]
run(*args)
if USE_PY_VENV:
# use built-in venv module
run(sys.executable, '-m', 'venv', envdir)
else:
# use virtualenv instead
try:
import virtualenv
except ImportError:
# install it when missing
run(sys.executable, '-m', 'pip', 'install', '--user', 'virtualenv')
run(sys.executable, '-m', 'virtualenv', envdir)
return envdir


Expand Down

0 comments on commit 3d20744

Please sign in to comment.