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 80400158087 for ; Thu, 3 Feb 2022 08:37:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CBA502BC01E; Thu, 3 Feb 2022 08:36:59 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id AE8E62BC01E for ; Thu, 3 Feb 2022 08:36:59 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5E689342FFF for ; Thu, 3 Feb 2022 08:36:58 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 00D441BD for ; Thu, 3 Feb 2022 08:36:57 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1643877407.a8e4f9297a38b3a0465b29aca32f14ce88720aa9.mgorny@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: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: a8e4f9297a38b3a0465b29aca32f14ce88720aa9 X-VCS-Branch: master Date: Thu, 3 Feb 2022 08:36:57 +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: bbe7ed2c-5576-4a4f-9a00-2400557469f1 X-Archives-Hash: 02935806a20537fda0f91ee8adac0059 commit: a8e4f9297a38b3a0465b29aca32f14ce88720aa9 Author: Michał Górny gentoo org> AuthorDate: Wed Jan 26 09:56:59 2022 +0000 Commit: Michał Górny gentoo org> CommitDate: Thu Feb 3 08:36:47 2022 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-syntax.git/commit/?id=a8e4f929 gentoo-common: Support collapsing PYTHON_COMPAT into {x..y} Signed-off-by: Michał Górny gentoo.org> plugin/gentoo-common.vim | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/plugin/gentoo-common.vim b/plugin/gentoo-common.vim index 306542e..bc4da76 100644 --- a/plugin/gentoo-common.vim +++ b/plugin/gentoo-common.vim @@ -80,22 +80,40 @@ fun! GentooGetPythonTargets() endfor let l:impls = [] if len(l:py3s) ==# 1 - let l:impls = l:impls->add("python3.".l:py3s->join()) + 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(",")."}") + let l:min = "" + let l:max = "" + let l:py3s = l:py3s->sort('N') + for l:py in l:py3s + if l:min ==# "" + let l:min = l:py + let l:max = l:py + elseif l:py ==# l:max + 1 + let l:max = l:py + else + let l:max = "" + break + endif + endfor + + if l:max !=# "" + let l:impls = l:impls->add("python3_{".l:min.".." + \ .l:max."}") + else + let l:impls = l:impls->add("python3_{".l:py3s + \ ->join(",")."}") + endif 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") + \ ->substitute("\n", "", "g")->substitute("[.]", "_", "g") endif - let l:pythons = substitute(l:py3, "[.]", "_", "g") - - let g:gentoopythontargets = l:pythons + let g:gentoopythontargets = l:py3 return g:gentoopythontargets endif endfun