From 7e4a8b4731865726f17343c6367db6e108a8f52c Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Mon, 8 Nov 2021 18:48:41 +0800 Subject: [PATCH 1/2] Update pythonfinder to 1.2.9 --- pipenv/vendor/pythonfinder/LICENSE.txt | 20 ++++++++++++++++++++ pipenv/vendor/pythonfinder/__init__.py | 2 +- pipenv/vendor/pythonfinder/models/python.py | 9 ++++++--- pipenv/vendor/pythonfinder/models/windows.py | 2 ++ pipenv/vendor/pythonfinder/utils.py | 2 +- pipenv/vendor/vendor.txt | 2 +- 6 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 pipenv/vendor/pythonfinder/LICENSE.txt diff --git a/pipenv/vendor/pythonfinder/LICENSE.txt b/pipenv/vendor/pythonfinder/LICENSE.txt new file mode 100644 index 00000000..4715db36 --- /dev/null +++ b/pipenv/vendor/pythonfinder/LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2018 Dan Ryan + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/pipenv/vendor/pythonfinder/__init__.py b/pipenv/vendor/pythonfinder/__init__.py index 326a655f..7ff28b14 100644 --- a/pipenv/vendor/pythonfinder/__init__.py +++ b/pipenv/vendor/pythonfinder/__init__.py @@ -10,7 +10,7 @@ from .exceptions import InvalidPythonVersion from .models import SystemPath, WindowsFinder from .pythonfinder import Finder -__version__ = "1.2.8" +__version__ = "1.2.9" logger = logging.getLogger(__name__) diff --git a/pipenv/vendor/pythonfinder/models/python.py b/pipenv/vendor/pythonfinder/models/python.py index d001a1e5..3c2a13de 100644 --- a/pipenv/vendor/pythonfinder/models/python.py +++ b/pipenv/vendor/pythonfinder/models/python.py @@ -3,6 +3,7 @@ from __future__ import absolute_import, print_function import logging import operator +import os import platform import sys from collections import defaultdict @@ -133,6 +134,8 @@ class PythonFinder(BaseFinder, BasePath): # type: (Union[Path, str]) -> Path if isinstance(base, six.string_types): base = Path(base) + if os.name == "nt": + return base return base / "bin" @classmethod @@ -451,9 +454,9 @@ class PythonVersion(object): if arch.isdigit(): arch = "{0}bit".format(arch) if ( - (major is None or self.major and self.major == major) - and (minor is None or self.minor and self.minor == minor) - and (patch is None or self.patch and self.patch == patch) + (major is None or self.major == major) + and (minor is None or self.minor == minor) + and (patch is None or self.patch == patch) and (pre is None or self.is_prerelease == pre) and (dev is None or self.is_devrelease == dev) and (arch is None or own_arch == arch) diff --git a/pipenv/vendor/pythonfinder/models/windows.py b/pipenv/vendor/pythonfinder/models/windows.py index fb36a272..794a881c 100644 --- a/pipenv/vendor/pythonfinder/models/windows.py +++ b/pipenv/vendor/pythonfinder/models/windows.py @@ -92,6 +92,8 @@ class WindowsFinder(BaseFinder): path = ensure_path(install_path.__getattr__("")) except AttributeError: continue + if not path.exists(): + continue try: py_version = PythonVersion.from_windows_launcher( version_object, name=name, company=company diff --git a/pipenv/vendor/pythonfinder/utils.py b/pipenv/vendor/pythonfinder/utils.py index c3db7261..0ccb3427 100644 --- a/pipenv/vendor/pythonfinder/utils.py +++ b/pipenv/vendor/pythonfinder/utils.py @@ -62,7 +62,7 @@ else: KNOWN_EXTS = KNOWN_EXTS | set( filter(None, os.environ.get("PATHEXT", "").split(os.pathsep)) ) -PY_MATCH_STR = r"((?P{0})(?:\d?(?:\.\d[cpm]{{0,3}}))?(?:-?[\d\.]+)*)".format( +PY_MATCH_STR = r"((?P{0})(?:\d?(?:\.\d[cpm]{{0,3}}))?(?:-?[\d\.]+)*(?!w))".format( "|".join(PYTHON_IMPLEMENTATIONS) ) EXE_MATCH_STR = r"{0}(?:\.(?P{1}))?".format(PY_MATCH_STR, "|".join(KNOWN_EXTS)) diff --git a/pipenv/vendor/vendor.txt b/pipenv/vendor/vendor.txt index ad73c48d..664c531f 100644 --- a/pipenv/vendor/vendor.txt +++ b/pipenv/vendor/vendor.txt @@ -35,7 +35,7 @@ ptyprocess==0.7.0 pyparsing==2.4.7 python-dateutil==2.8.2 python-dotenv==0.19.0 -pythonfinder==1.2.8 +pythonfinder==1.2.9 requests==2.26.0 requirementslib==1.6.1 shellingham==1.4.0 From 1c60ba2367aed4cb4822dab2014bbf75edb1514b Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Mon, 8 Nov 2021 18:49:26 +0800 Subject: [PATCH 2/2] add news fragment --- news/4837.vendor.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/4837.vendor.rst diff --git a/news/4837.vendor.rst b/news/4837.vendor.rst new file mode 100644 index 00000000..6404c1d5 --- /dev/null +++ b/news/4837.vendor.rst @@ -0,0 +1 @@ +Update ``pythonfinder`` from ``1.2.8`` to ``1.2.9``.