mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Cleanup core and help to use new finder
Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
@@ -332,30 +332,11 @@ def find_a_system_python(python):
|
||||
return python_entry.path.as_posix()
|
||||
if os.path.isabs(python):
|
||||
return python
|
||||
# version = [int(v) for v in python.split('.')]
|
||||
# minor = None
|
||||
# patch = None
|
||||
# if len(version) > 1:
|
||||
# minor = version[1]
|
||||
# if len(version) > 2:
|
||||
# patch = version[2]
|
||||
# python_entries = getattr(finder, 'system_path').find_all_python_versions(version[0])
|
||||
# python_entries = [(entry.py_version.version_tuple, entry) for entry in python_entries]
|
||||
python_entry = finder.find_python_version(python)
|
||||
# if minor and patch:
|
||||
# _py = first(entry for entry in python_entries if entry[0][:3] == (version[0], minor, patch))
|
||||
# python_entry = _py[1] if _py else None
|
||||
# elif minor:
|
||||
# _py = first(entry for entry in python_entries if entry[0][:3] == (version[0], minor))
|
||||
# python_entry = _py[1] if _py else None
|
||||
# else:
|
||||
# _py = first(python_entries)
|
||||
# python_entry = _py[1] if _py else None
|
||||
if not python_entry:
|
||||
exe_name = "python{0}".format(python)
|
||||
python_entry = finder.which(exe_name)
|
||||
if python_entry:
|
||||
click.echo("Found python: {0} => {1}".format(python_entry.as_python.version, python_entry.path.as_posix()))
|
||||
return python_entry.path.as_posix()
|
||||
return None
|
||||
|
||||
|
||||
+1
-2
@@ -30,8 +30,7 @@ def get_pipenv_diagnostics():
|
||||
print("Other Python installations in `PATH`:")
|
||||
print("")
|
||||
finder = pythonfinder.Finder(system=False, global_search=True)
|
||||
python_versions = (getattr(finder, 'system_path').find_all_python_versions(major) for major in (2, 3))
|
||||
python_paths = list(chain(*python_versions))
|
||||
python_paths = getattr(finder, 'system_path').find_all_python_versions()
|
||||
for python in python_paths:
|
||||
python_version = python.py_version.version
|
||||
python_path = python.path.as_posix()
|
||||
|
||||
Reference in New Issue
Block a user