Mercurial > hg
changeset 46097:1b5e0d0bdb05
hghave: update the check for virtualenv
This started as `hghave --test-features` failing on Windows in `test-hghave.t`.
IDK how this worked, as neither my Linux nor Windows machines have the old
attribute with virtualenv 20.2.2, even on py2. I think this was noticed
recently because 357d8415aa27 mentioned an AttributeError, and mitigated by
making this py2 only. But as mentioned, this is also a problem on py2 (where
the failure was observed).
When I got this working by removing the attribute reference, the command in the
test failed because the `--no-site-package` argument was removed some time ago.
Therefore, this backs out 357d8415aa27 and references a known good attribute
(which was done to suppress the warning about an unused import) that also
ensures the command does not need the argument. Since there appears to be
(minor) broken stuff on py3, manually apply the `no-py3` guard that was backed
out of the check itself.
Differential Revision: https://phab.mercurial-scm.org/D9547
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 08 Dec 2020 12:43:18 -0500 |
parents | 4d5e2fd53707 |
children | 5510e2ac213f |
files | tests/hghave.py tests/test-install.t |
diffstat | 2 files changed, 11 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/hghave.py Sat Dec 05 23:35:55 2020 +0100 +++ b/tests/hghave.py Tue Dec 08 12:43:18 2020 -0500 @@ -886,17 +886,16 @@ return False -@check("py2virtualenv", "Python2 virtualenv support") -def has_py2virtualenv(): - if sys.version_info[0] != 2: - return False - +@check("virtualenv", "virtualenv support") +def has_virtualenv(): try: import virtualenv - virtualenv.ACTIVATE_SH - return True - except ImportError: + # --no-site-package became the default in 1.7 (Nov 2011), and the + # argument was removed in 20.0 (Feb 2020). Rather than make the + # script complicated, just ignore ancient versions. + return int(virtualenv.__version__.split('.')[0]) > 1 + except (AttributeError, ImportError, IndexError): return False
--- a/tests/test-install.t Sat Dec 05 23:35:55 2020 +0100 +++ b/tests/test-install.t Tue Dec 08 12:43:18 2020 -0500 @@ -222,13 +222,11 @@ no problems detected #endif -#if py2virtualenv +#if virtualenv no-py3 -Note: --no-site-packages is deprecated, but some places have an -ancient virtualenv from their linux distro or similar and it's not yet -the default for them. +Note: --no-site-packages is the default for all versions enabled by hghave - $ "$PYTHON" -m virtualenv --no-site-packages --never-download installenv >> pip.log + $ "$PYTHON" -m virtualenv --never-download installenv >> pip.log DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. (?) DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support (?) @@ -237,6 +235,7 @@ $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. (?) DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support (?) + DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. (?) $ ./installenv/*/hg debuginstall || cat pip.log checking encoding (ascii)... checking Python executable (*) (glob)