Merge pull request #3156 from pypa/bugfix/2983

Fixed a bug with encountering removed pythons
This commit is contained in:
Dan Ryan
2018-11-03 18:40:31 -04:00
committed by GitHub
4 changed files with 19 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
Pipenv will no longer fail when encountering python versions on Windows that were unintalled.
+1 -1
View File
@@ -1,6 +1,6 @@
from __future__ import print_function, absolute_import
__version__ = '1.1.6'
__version__ = '1.1.7.dev0'
# Add NullHandler to "pythonfinder" logger, because Python2's default root
# logger has no handler and warnings like this would be reported:
+13
View File
@@ -56,7 +56,20 @@ def cli(ctx, find=False, which=False, findall=False, version=False, ignore_unsup
click.secho("Searching for python: {0!s}".format(find.strip()), fg="yellow")
found = finder.find_python_version(find.strip())
if found:
py = found.py_version
comes_from = getattr(py, "comes_from", None)
if comes_from is not None:
comes_from_path = getattr(comes_from, "path", found.path)
else:
comes_from_path = found.path
arch = getattr(py, "architecture", None)
click.secho("Found python at the following locations:", fg="green")
click.secho(
"{py.name!s}: {py.version!s} ({py.architecture!s}) @ {comes_from!s}".format(
py=py, comes_from=comes_from_path
),
fg="yellow",
)
sys.exit(0)
else:
click.secho("Failed to find matching executable...", fg="yellow")
+4 -1
View File
@@ -84,7 +84,10 @@ class WindowsFinder(BaseFinder):
install_path = getattr(version_object.info, "install_path", None)
if install_path is None:
continue
path = ensure_path(install_path.__getattr__(""))
try:
path = ensure_path(install_path.__getattr__(""))
except AttributeError:
continue
try:
py_version = PythonVersion.from_windows_launcher(version_object)
except InvalidPythonVersion: