From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7F027158086 for ; Fri, 10 Dec 2021 11:41:10 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C20202BC024; Fri, 10 Dec 2021 11:41:09 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8631E2BC024 for ; Fri, 10 Dec 2021 11:41:09 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1CA17340FEE for ; Fri, 10 Dec 2021 11:41:08 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C80DF14D for ; Fri, 10 Dec 2021 11:41:05 +0000 (UTC) From: "Vadim Misbakh-Soloviov" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Vadim Misbakh-Soloviov" Message-ID: <1639135654.2455886f7fde605f081bc5fa95c5735ca89afd2d.mva@gentoo> Subject: [gentoo-commits] proj/gentoo-syntax:master commit in: plugin/ X-VCS-Repository: proj/gentoo-syntax X-VCS-Files: plugin/gentoo-common.vim X-VCS-Directories: plugin/ X-VCS-Committer: mva X-VCS-Committer-Name: Vadim Misbakh-Soloviov X-VCS-Revision: 2455886f7fde605f081bc5fa95c5735ca89afd2d X-VCS-Branch: master Date: Fri, 10 Dec 2021 11:41:05 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7d963c37-143d-4a15-9d39-8facfc34c1c5 X-Archives-Hash: d7af633f9a087bfea76e53e418db1bac commit: 2455886f7fde605f081bc5fa95c5735ca89afd2d Author: Vadim Misbakh-Soloviov gentoo org> AuthorDate: Thu Dec 9 09:12:18 2021 +0000 Commit: Vadim Misbakh-Soloviov gentoo org> CommitDate: Fri Dec 10 11:27:34 2021 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-syntax.git/commit/?id=2455886f gentoo-common: try to load pythons from python-exec.conf Signed-off-by: Vadim Misbakh-Soloviov gentoo.org> plugin/gentoo-common.vim | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/plugin/gentoo-common.vim b/plugin/gentoo-common.vim index 42b2451..50478ba 100644 --- a/plugin/gentoo-common.vim +++ b/plugin/gentoo-common.vim @@ -56,8 +56,32 @@ 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:pyexec_path = "/etc/python-exec/python-exec.conf" + + if filereadable(l:pyexec_path) + let l:pys = readfile(l:pyexec_path)->filter("v:val =~ '^[^#-]'")->sort() + let l:py3s = [] + let l:others = [] + for l:py in l:pys + let l:m = l:py->matchstr("^python3.*")->matchstr("\\d*$") + if !empty(l:m) + eval l:py3s->add(l:m) + continue + else + eval l:others->add(l:py) + endif + endfor + let l:impls = [] + if len(l:py3s) ==# 1 + let l:impls = l:impls->add("python3.".l:py3s->join()) + elseif len(l:py3s) > 1 + let l:impls = l:impls->add("python3.{".l:py3s->sort('N')->join(",")."}") + endif + let l:py3 = flatten(l:impls->add(l:others))->join() + endif + if empty(l:py3) + let l:py3 = system("python -c 'import epython; print(epython.EPYTHON)'")->substitute("\n","","g") + endif let l:pythons = substitute(l:py3, "[.]", "_", "g")