Skip to content

Commit

Permalink
Specify Python exec path with minor version if available (psf#3507)
Browse files Browse the repository at this point in the history
  • Loading branch information
kephircheek committed Mar 18, 2023
1 parent 22169d0 commit 54881f2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion autoload/black.vim
Expand Up @@ -43,7 +43,15 @@ def _get_python_binary(exec_prefix, pyver):
return default
if sys.platform[:3] == "win":
return exec_prefix / 'python.exe'
return exec_prefix / 'bin' / f'python{pyver[0]}.{pyver[1]}'
bin_path = exec_prefix / "bin"
exec_path = (bin_path / f"python{pyver[0]}.{pyver[1]}").resolve()
if exec_path.exists():
return exec_path
# It is possible that some environments may only have python3
exec_path = (bin_path / f"python3").resolve()
if exec_path.exists():
return exec_path
raise ValueError("python executable not found")

def _get_pip(venv_path):
if sys.platform[:3] == "win":
Expand Down

0 comments on commit 54881f2

Please sign in to comment.