diff options
author | Michał Górny <mgorny@gentoo.org> | 2016-01-27 14:29:47 +0100 |
---|---|---|
committer | Tim Harder <radhermit@gentoo.org> | 2016-03-05 18:31:09 -0500 |
commit | 3c2c6e68310a16b96c058c9fa7e66b3119b88a89 (patch) | |
tree | 86e57c731208e1c739b62c41e8275091376f0b2e | |
parent | GentooGetArch: default to amd64 rather than x86 (diff) | |
download | gentoo-syntax-3c2c6e68310a16b96c058c9fa7e66b3119b88a89.tar.gz gentoo-syntax-3c2c6e68310a16b96c058c9fa7e66b3119b88a89.tar.bz2 gentoo-syntax-3c2c6e68310a16b96c058c9fa7e66b3119b88a89.zip |
newebuild: Guess PYTHON_TARGETS from system
-rw-r--r-- | plugin/gentoo-common.vim | 23 | ||||
-rw-r--r-- | plugin/newebuild.vim | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/plugin/gentoo-common.vim b/plugin/gentoo-common.vim index 99bc29d..bacecd9 100644 --- a/plugin/gentoo-common.vim +++ b/plugin/gentoo-common.vim @@ -54,4 +54,27 @@ fun! GentooGetArch() endif endfun +fun! GentooGetPythonTargets() + if exists("g:gentoopythontargets") && g:gentoopythontargets != "" + return g:gentoopythontargets + else + let l:py2 = system("eselect python show --python2") + let l:py2 = substitute(l:py2, "\n", "", "g") + let l:py3 = system("eselect python show --python3") + let l:py3 = substitute(l:py3, "\n", "", "g") + + if l:py2 == "" + let l:py2 = "python2.7" + endif + if l:py3 == "" + let l:py3 = "python3.4" + endif + + let l:pythons = substitute(l:py2 . " " . l:py3, "[.]", "_", "g") + + let g:gentoopythontargets = l:pythons + return g:gentoopythontargets + endif +endfun + " vim: set et foldmethod=marker : " diff --git a/plugin/newebuild.vim b/plugin/newebuild.vim index c2bcd1c..7197e41 100644 --- a/plugin/newebuild.vim +++ b/plugin/newebuild.vim @@ -144,7 +144,7 @@ fun! <SID>MakeNewEbuild() " {{{ standard default setup " {{{ extra inherits for some categories if l:category ==# "dev-python" - put ='PYTHON_COMPAT=( python2_7 python3_4 )' + put ='PYTHON_COMPAT=( ' . GentooGetPythonTargets() . ' )' put ='inherit distutils-r1' put ='' elseif l:category =~# "^xfce-" |