From b9ffb566a02c5a968f05af9b49a7b354c3d91b61 Mon Sep 17 00:00:00 2001 From: Ilia Lazarev Date: Fri, 20 Jan 2023 18:39:44 +0300 Subject: [PATCH] Specify python binary path with minor version (#3507) --- CHANGES.md | 1 + autoload/black.vim | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1450278341b..32cdefcfd0d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -81,6 +81,7 @@ - Move 3.11 CI to normal flow now all dependencies support 3.11 (#3446) - Docker: Add new `latest_prerelease` tag automation to follow latest black alpha release on docker images (#3465) +- Fixed missing python binary path in autoload script for vim (#3507) ### Documentation diff --git a/autoload/black.vim b/autoload/black.vim index 5aec8725bd0..273fb7c51c5 100644 --- a/autoload/black.vim +++ b/autoload/black.vim @@ -34,7 +34,7 @@ FLAGS = [ ] -def _get_python_binary(exec_prefix): +def _get_python_binary(exec_prefix, pyver): try: default = vim.eval("g:pymode_python").strip() except vim.error: @@ -43,7 +43,7 @@ def _get_python_binary(exec_prefix): return default if sys.platform[:3] == "win": return exec_prefix / 'python.exe' - return exec_prefix / 'bin' / 'python3' + return exec_prefix / 'bin' / f'python{pyver[0]}.{pyver[1]}' def _get_pip(venv_path): if sys.platform[:3] == "win": @@ -82,7 +82,7 @@ def _initialize_black_env(upgrade=False): _executable = sys.executable _base_executable = getattr(sys, "_base_executable", _executable) try: - executable = str(_get_python_binary(Path(sys.exec_prefix))) + executable = str(_get_python_binary(Path(sys.exec_prefix), pyver)) sys.executable = executable sys._base_executable = executable print(f'Creating a virtualenv in {virtualenv_path}...')