venvlib: use --setuptools with <1.10 versions
Newer virtualenv-20 versions changed the meaning of this flag. We
had this in here only for old versions of virtualenv, so use it only
with those old versions.
BUG=chromium:1092855
TEST=CQ passes
Change-Id: I8d968aea85b4250ad068d0e2d7df52748cf8520c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra_virtualenv/+/2238482
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/venv/cros_venv/venvlib.py b/venv/cros_venv/venvlib.py
index 23ad156..30d1bc5 100644
--- a/venv/cros_venv/venvlib.py
+++ b/venv/cros_venv/venvlib.py
@@ -246,15 +246,16 @@
# set. See also https://github.com/pypa/virtualenv/issues/565
env.pop('VIRTUALENV_ALWAYS_COPY', None)
+ command = [_VIRTUALENV_COMMAND, venvdir, '-p', sys.executable,
+ '--extra-search-dir', _PACKAGE_DIR, '--clear']
# TODO(ayatane): Ubuntu Precise ships with virtualenv 1.7, which
# requires specifying --setuptools, else distribute is used
# (distribute is deprecated). virtualenv after 1.10 uses setuptools
# by default. virtualenv >1.10 accepts the --setuptools option but
# does not document it. Once we no longer have any hosts on
# virtualenv 1.7, the --setuptools option can be removed.
- command = [_VIRTUALENV_COMMAND, venvdir, '-p', sys.executable,
- '--extra-search-dir', _PACKAGE_DIR, '--setuptools',
- '--clear']
+ if ver < (1, 10):
+ command += ['--setuptools']
try:
_log_check_call(command, logfile=logfile, env=env)
except OSError as e: