Closed shibotto closed 2 years ago
Do you have a suggestion on how we could do that?
Maybe I should just replace it with something like processing the output of:
python -c 'import epython; print(epython.EPYTHON)'
I think that could be a reasonable default, assuming that the user is likely to test the package on the current Python version.
IMHO that sounds good.
Could you please test the git master now, and lemme know whether it helped you? I'll make a release then.
You can basically:
cp plugin/gentoo-common.vim /usr/share/vim/vimfiles/plugin/gentoo-common.vim
Works OK for me, this is the complete ebuild template I get:
# Copyright 2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_9 )
inherit distutils-r1
DESCRIPTION=""
HOMEPAGE=""
SRC_URI=""
LICENSE=""
SLOT="0"
KEYWORDS=""
DEPEND=""
RDEPEND="${DEPEND}"
BDEPEND=""
(KEYWORDS is missing because I made a -9999.ebuild)
And what about taking pythons directly from ${EPREFIX}/etc/python-exec/python-exec.conf
file?
Or can it be valid for it to not exist on non-broken system?
It effectively does that, by calling python
through python-exec
.
It effectively does that, by calling
python
throughpython-exec
.
Yeah, I've edited the message to reflect what I mean a second before your reply.
I mean: maybe it would worth to read the file directly, and take all the versions described there, and not just print current active version (like that python command does here on my system, at least)
Hmm, I suppose that makes sense too but TBH my vim-foo is too weak for that.
I'll try to do something like that in few hours (when finish up with tree-sitter PR stuff)
@mgorny, WDYT?
diff --git i/plugin/gentoo-common.vim w/plugin/gentoo-common.vim
index 42b2451..5c4b830 100644
--- i/plugin/gentoo-common.vim
+++ w/plugin/gentoo-common.vim
@@ -56,8 +56,19 @@ fun! GentooGetPythonTargets()
if exists("g:gentoopythontargets") && g:gentoopythontargets != ""
return g:gentoopythontargets
else
- let l:py3 = system("python -c 'import epython; print(epython.EPYTHON)'")
- let l:py3 = substitute(l:py3, "\n", "", "g")
+ let l:py3_list = []
+ for item in readfile('/etc/python-exec/python-exec.conf')
+ let l:py = matchstr(item,'^python.*')
+ if !empty(l:py)
+ call add(l:py3_list,l:py)
+ endif
+ endfor
+ if !empty(l:py3_list)
+ let l:py3 = join(l:py3_list)
+ else
+ let l:py3 = system("python -c 'import epython; print(epython.EPYTHON)'")
+ let l:py3 = substitute(l:py3, "\n", "", "g")
+ endif
let l:pythons = substitute(l:py3, "[.]", "_", "g")
Could you submit that as PR, so I can comment on specific lines, plz?
When eselect-python is not installed (which by now should be norm) creating a python related ebuild results in:
I think it needs to be updated to query PYTHON_TARGETS or PYTHON_SINGLE_TARGET.