From 594accf0cfec19d7cccd1147d48fbeebf523ecb5 Mon Sep 17 00:00:00 2001 From: PrajwalM2212 Date: Fri, 14 Feb 2020 21:31:50 +0530 Subject: [PATCH] py_info.py: Discover python interpreter in a case insensitive manner Closes https://github.com/pypa/virtualenv/issues/1624 --- docs/changelog/1624.bugfix.rst | 1 + src/virtualenv/discovery/py_info.py | 2 +- tests/unit/discovery/py_info/test_py_info.py | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 docs/changelog/1624.bugfix.rst diff --git a/docs/changelog/1624.bugfix.rst b/docs/changelog/1624.bugfix.rst new file mode 100644 index 000000000..d1f4876cd --- /dev/null +++ b/docs/changelog/1624.bugfix.rst @@ -0,0 +1 @@ +Discover python interpreter in a case insensitive manner - by :user:`PrajwalM2212` diff --git a/src/virtualenv/discovery/py_info.py b/src/virtualenv/discovery/py_info.py index 8e520ba0d..c897cf178 100644 --- a/src/virtualenv/discovery/py_info.py +++ b/src/virtualenv/discovery/py_info.py @@ -237,7 +237,7 @@ def satisfies(self, spec, impl_must_match): return False if impl_must_match: - if spec.implementation is not None and spec.implementation != self.implementation: + if spec.implementation is not None and spec.implementation.lower() != self.implementation.lower(): return False if spec.architecture is not None and spec.architecture != self.architecture: diff --git a/tests/unit/discovery/py_info/test_py_info.py b/tests/unit/discovery/py_info/test_py_info.py index b5272e473..dd898897e 100644 --- a/tests/unit/discovery/py_info/test_py_info.py +++ b/tests/unit/discovery/py_info/test_py_info.py @@ -56,7 +56,11 @@ def test_bad_exe_py_info_no_raise(tmp_path, caplog, capsys): list( "{}{}{}".format(impl, ".".join(str(i) for i in ver), arch) for impl, ver, arch in itertools.product( - ([CURRENT.implementation] + (["python"] if CURRENT.implementation == "CPython" else [])), + ( + [CURRENT.implementation] + + (["python"] if CURRENT.implementation == "CPython" else []) + + (["cpython"] if CURRENT.implementation == "CPython" else []) + ), [sys.version_info[0 : i + 1] for i in range(3)], ["", "-{}".format(CURRENT.architecture)], )