1
0
forked from VimPlug/jedi

Specify executable extension to detect virtual environment on Windows

This commit is contained in:
micbou
2018-03-22 21:00:53 +01:00
committed by Dave Halter
parent e6a3a8882c
commit 2283b67836

View File

@@ -189,10 +189,15 @@ def _get_executable_path(path, safe=True):
Returns None if it's not actually a virtual env.
"""
bin_name = 'Scripts' if os.name == 'nt' else 'bin'
if os.name == 'nt':
bin_name = 'Scripts'
extension = '.exe'
else:
bin_name = 'bin'
extension = ''
bin_folder = os.path.join(path, bin_name)
activate = os.path.join(bin_folder, 'activate')
python = os.path.join(bin_folder, 'python')
python = os.path.join(bin_folder, 'python' + extension)
if not all(os.path.exists(p) for p in (activate, python)):
raise InvalidPythonEnvironment("One of bin/activate and bin/python is missing.")