https://pantsbuild.org/ logo
a

average-vr-56795

02/16/2021, 9:27 PM
Is there a reason
build-support/virtualenv
downloads and uses
virtualenv
? I would've thought these days that whole script could be replaced with
python -m venv
, given we're py3-only at this point?
(I ask because I had a bunch of issues getting
virtualenv
to play nice with the python interpreters I have installed on my Mac, but just doing this made it happy:
Copy code
diff --git a/build-support/virtualenv b/build-support/virtualenv
index 06016fc1b..02c6bd156 100755
--- a/build-support/virtualenv
+++ b/build-support/virtualenv
@@ -24,21 +24,4 @@ fi
 
 log "Using Python at ${PY}"
 
-HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
-if ! [ -f "${HERE}/virtualenv.dist/BOOTSTRAPPED-${VIRTUALENV_VERSION}" ]; then
-  pushd "${HERE}" >/dev/null
-    VIRTUALENV_PACKAGE_FULL_URL="${VIRTUALENV_PACKAGE_LOCATION}/virtualenv-${VIRTUALENV_VERSION}.tar.gz"
-    log "Downloading ${VIRTUALENV_PACKAGE_FULL_URL}..."
-    curl -#L -O "${VIRTUALENV_PACKAGE_FULL_URL}" || \
-      die "Failed to download ${VIRTUALENV_PACKAGE_FULL_URL}."
-    rm -rf virtualenv-${VIRTUALENV_VERSION}
-    tar zxf virtualenv-${VIRTUALENV_VERSION}.tar.gz || \
-      die "Failed to extract ${VIRTUALENV_PACKAGE_FULL_URL}."
-    # TODO(ksweeney): Checksum
-    touch virtualenv-${VIRTUALENV_VERSION}/BOOTSTRAPPED-${VIRTUALENV_VERSION} && \
-      rm -rf virtualenv.dist && \
-      mv -f virtualenv-${VIRTUALENV_VERSION} virtualenv.dist
-  popd >/dev/null
-fi
-
-exec "${PY}" "${HERE}/virtualenv.dist/virtualenv.py" "$@"
+"${PY}" -m venv "$@"
h

hundreds-father-404

02/16/2021, 9:28 PM
Yeah, I tried to use the builtin one and I think it broke linux CI 😕 one sec
e

enough-analyst-54434

02/16/2021, 9:29 PM
Some Linux distributions are weird like that - we should just document. Devs are grownups.
Ubuntu requires python-dev or python-venv, etc.
It depends on the distro - but a dev should be able to take the instructions - install a full python environment and deal with that imo.
You know your OS - or if you don't .... we can't teach you that really.
I think the short-take on this state of affairs in Linux distros is they treat CPython like the jvm and assume there is a JVM different from a JDK. There isn't afaict since the python docs don't say
ensurepip
or
venv
are somehow optional modules.
a

average-vr-56795

02/16/2021, 9:35 PM
Sigh 😞 Thanks for trying!
e

enough-analyst-54434

02/16/2021, 9:36 PM
Yeah, so @hundreds-father-404 and @average-vr-56795 how do you feel about docs in README / on the docsite that just warn devs about this? I think we should be able to expect a little bit more from devs.
a

average-vr-56795

02/16/2021, 9:37 PM
I don't feel super strongly either way 🙂 (Though I do know that if we don't do so, I'll need to do the studying of system python configs for macOS that you're expecting of my Linux counterparts 🙂)
e

enough-analyst-54434

02/16/2021, 9:38 PM
Afaict in macOS land ~noone uses the System pythons because they're habitually broken and brew, Python.org and yenv all package a full python unlike debian.
a

average-vr-56795

02/16/2021, 9:39 PM
Yeah, I'm conditioned not to use system python, but my brew python is also broken 😄
e

enough-analyst-54434

02/16/2021, 9:39 PM
Nice
h

hundreds-father-404

02/16/2021, 9:39 PM
Yeah given that it only impacts pantsbuild/pants devs, I'm cool with requiring ensurepip to be installed