1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-05 11:01:13 +02:00

Specify system python in dnf completion

The python executable in the python_exec variable was the python[2|3]
executable found in $PATH. When the python[2|3] executable was not the
system installed version the completion command raised an `ImportError`
as the 'dnf' module was not found.

This commit just completely specifies the python version to be the
system version `/usr/bin/python[2|3]`, allowing completion within a
python dev environment.
This commit is contained in:
Malcolm Ramsay 2017-11-10 22:21:20 +11:00 committed by Oliver Kiddle
parent 2c00d2132c
commit d8e3218938
2 changed files with 7 additions and 4 deletions

View file

@ -1,7 +1,10 @@
2017-11-13 Oliver Kiddle <opk@zsh.org>
* github #19: Chris Bracken: Fix minor typo in
INC_APPEND_HISTORY documentation
* github #18: Malcolm Ramsay: Completion/Redhat/Command/_dnf:
Explicitly use system python so the dnf module can be found
* github #19: Chris Bracken: Doc/Zsh/options.yo: Fix minor typo
in INC_APPEND_HISTORY documentation
2017-11-11 Peter Stephenson <p.w.stephenson@ntlworld.com>

View file

@ -38,9 +38,9 @@ _dnf_local_packages() {
_dnf() {
if [[ "$(readlink /usr/bin/dnf)" == "dnf-2" ]]; then
local python_exec="python2"
local python_exec="/usr/bin/python2"
else
local python_exec="python3"
local python_exec="/usr/bin/python3"
fi
local helper=$(${python_exec} -c "import dnf.cli; print('{}/completion_helper.py'.format(dnf.cli.__path__[0]))")
local cache_file="/var/cache/dnf/packages.db"