From 4931ddd0b1f84910790bebcd86c2147d1ddcf1e1 Mon Sep 17 00:00:00 2001 From: pmacosta Date: Tue, 7 May 2019 13:28:56 -0400 Subject: [PATCH 1/1] Use g:pymode_python-defined interpreter if defined and exists, otherwise use existing defaults (#666) This is helpful when using custom-compiled interpreters, or alternative Python interpreters in non-standard locations --- plugin/black.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugin/black.vim b/plugin/black.vim index 36825cf..15a13d1 100644 --- a/plugin/black.vim +++ b/plugin/black.vim @@ -37,10 +37,17 @@ if !exists("g:black_skip_string_normalization") endif python3 << endpython3 +import os import sys import vim def _get_python_binary(exec_prefix): + try: + default = vim.eval("g:pymode_python").strip() + except vim.error: + default = "" + if default and os.path.exists(default): + return default if sys.platform[:3] == "win": return exec_prefix / 'python.exe' return exec_prefix / 'bin' / 'python3' -- 2.39.2