From 179c46a016388c2acead17e56d5860e667748561 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 30 Sep 2019 12:52:04 +0200 Subject: provider#pythonx: resolve/expand exe from host var (#11047) This reverts part of ade88fe4c [1]. This is required for `let g:python3_host_prog = 'python'` etc, where it should get picked up from PATH. Without this it would show: ``` - INFO: pyenv: Path: /home/user/.pyenv/libexec/pyenv - INFO: pyenv: Root: /home/user/.pyenv - INFO: Using: g:python3_host_prog = "python" - ERROR: "python" was not found. - INFO: Executable: Not found - ERROR: Detected pip upgrade failure: Python executable can import "pynvim" but not "neovim": python - ADVICE: - Use that Python version to reinstall "pynvim" and optionally "neovim". pip3 uninstall pynvim neovim pip3 install pynvim pip3 install neovim # only if needed by third-party software ``` Note that it additionally causes a weird error ("Detected pip upgrade failure"), due to `s:check_bin` emptying `python_exe` (because the non-absolute file not being readable), and `provider#pythonx#DetectByModule('pynvim', a:version)` from 75593e6fce then just getting the value from the host var again (without actual checks). This is implicitly fixed via this patch now (because it is skipped), but could need some improvement in this regard probably. With this patch it resolves it (for a virtualenv where pynvim is not made available intentionally): ``` - INFO: pyenv: Path: /home/daniel/.pyenv/libexec/pyenv - INFO: pyenv: Root: /home/daniel/.pyenv - INFO: Using: g:python3_host_prog = "python" - WARNING: $VIRTUAL_ENV exists but appears to be inactive. This could lead to unexpected results. - ADVICE: - If you are using Zsh, see: http://vi.stackexchange.com/a/7654 - INFO: Executable: /home/daniel/.pyenv/shims/tmp-system-deoplete.nvim-f205aF/python - ERROR: Command error (job=11, exit code 1): `'/home/daniel/.pyenv/shims/tmp-system-deoplete.nvim-f205aF/python' -c 'import sys; sys.path.remove(""); import neovim; print(neovim.__file__)'` (in '/home/daniel/.dotfiles/vim/plugged/deoplete.nvim') Output: Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'neovim' Stderr: Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'neovim' - INFO: Python version: 3.7.4 - INFO: pynvim version: unable to load neovim Python module - ERROR: pynvim is not installed. Error: unable to load neovim Python module - ADVICE: - Run in shell: pip3 install pynvim ``` Note: this appears to display the error twice via "Output:" and "Stderr:". 1: https://github.com/neovim/neovim/pull/8784 --- runtime/autoload/provider/pythonx.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/autoload/provider/pythonx.vim') diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim index 59b1c27b72..6ce7165467 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -43,7 +43,7 @@ function! provider#pythonx#DetectByModule(module, major_version) abort let python_exe = s:get_python_executable_from_host_var(a:major_version) if !empty(python_exe) - return [python_exe, ''] + return [exepath(expand(python_exe)), ''] endif let candidates = s:get_python_candidates(a:major_version) -- cgit From 31536ae003c0bd0ee311fc97b26ded0db8b3fa34 Mon Sep 17 00:00:00 2001 From: supermomonga Date: Mon, 28 Oct 2019 06:27:22 +0900 Subject: provider/pythonx: don't assume CWD (empty string) is in path #11304 sys.path.remove("") raises ValueError if the item is missing. https://docs.python.org/3/library/functions.html#filter: > filter(function, iterable) is equivalent to the generator expression (item > for item in iterable if function(item)) fixes #11293 --- runtime/autoload/provider/pythonx.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/autoload/provider/pythonx.vim') diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim index 6ce7165467..aec18c0508 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -10,7 +10,8 @@ function! provider#pythonx#Require(host) abort " Python host arguments let prog = (ver == '2' ? provider#python#Prog() : provider#python3#Prog()) - let args = [prog, '-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()'] + let args = [prog, '-c', 'import sys; sys.path = list(filter(lambda x: x != "", sys.path)); import neovim; neovim.start_host()'] + " Collect registered Python plugins into args let python_plugins = remote#host#PluginsForHost(a:host.name) @@ -66,7 +67,7 @@ endfunction function! s:import_module(prog, module) abort let prog_version = system([a:prog, '-c' , printf( \ 'import sys; ' . - \ 'sys.path.remove(""); ' . + \ 'sys.path = list(filter(lambda x: x != "", sys.path)); ' . \ 'sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1])); ' . \ 'import pkgutil; ' . \ 'exit(2*int(pkgutil.get_loader("%s") is None))', -- cgit From 97f1222005838912e127e4180d7b779c82e8356d Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Sun, 17 Nov 2019 14:23:17 +0100 Subject: provider/python: add python3.8 executable (#11402) Python 3.8 was released 2019-10-14: https://www.python.org/dev/peps/pep-0569 --- runtime/autoload/provider/pythonx.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/autoload/provider/pythonx.vim') diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim index aec18c0508..23e7ff8f64 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -29,8 +29,8 @@ endfunction function! s:get_python_candidates(major_version) abort return { \ 2: ['python2', 'python2.7', 'python2.6', 'python'], - \ 3: ['python3', 'python3.7', 'python3.6', 'python3.5', 'python3.4', 'python3.3', - \ 'python'] + \ 3: ['python3', 'python3.8', 'python3.7', 'python3.6', 'python3.5', + \ 'python3.4', 'python3.3', 'python'] \ }[a:major_version] endfunction -- cgit From 7116105d661011cc4bdd5e01e1321d1e500b6b5b Mon Sep 17 00:00:00 2001 From: Faris A Chugthai <20028782+farisachugthai@users.noreply.github.com> Date: Wed, 20 May 2020 07:57:46 -0400 Subject: provider: Add python3.9 to autoload/provider/pythonx.vim (#12344) 3.9's scheduled for beta release today. https://www.python.org/dev/peps/pep-0596/ --- runtime/autoload/provider/pythonx.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/autoload/provider/pythonx.vim') diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim index 23e7ff8f64..ffb9bf3021 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -29,7 +29,7 @@ endfunction function! s:get_python_candidates(major_version) abort return { \ 2: ['python2', 'python2.7', 'python2.6', 'python'], - \ 3: ['python3', 'python3.8', 'python3.7', 'python3.6', 'python3.5', + \ 3: ['python3', 'python3.9', 'python3.8', 'python3.7', 'python3.6', 'python3.5', \ 'python3.4', 'python3.3', 'python'] \ }[a:major_version] endfunction -- cgit From d17e38e48209c19b63d809c5b807613f15aa03c8 Mon Sep 17 00:00:00 2001 From: erw7 Date: Wed, 5 Feb 2020 16:04:45 +0900 Subject: Add overlapped option to jobstart When UV_OVERLAPPED_PIPE was used for the pipe passed to the child process, a problem occurred with the standard input of the .Net Framework application (#11809). Therefore, add the overlapped option to jobstart() and change it so that it is set only when necessary --- runtime/autoload/provider/pythonx.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/autoload/provider/pythonx.vim') diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim index ffb9bf3021..e89d519790 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -19,7 +19,7 @@ function! provider#pythonx#Require(host) abort call add(args, plugin.path) endfor - return provider#Poll(args, a:host.orig_name, '$NVIM_PYTHON_LOG_FILE') + return provider#Poll(args, a:host.orig_name, '$NVIM_PYTHON_LOG_FILE', {'overlapped': v:true}) endfunction function! s:get_python_executable_from_host_var(major_version) abort -- cgit