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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id F04B9138334 for ; Sat, 8 Sep 2018 07:09:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E8E47E088A; Sat, 8 Sep 2018 07:09:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 92006E0885 for ; Sat, 8 Sep 2018 07:09:50 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 6C522335C2B; Sat, 8 Sep 2018 07:09:47 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: python@gentoo.org, =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH] python-utils-r1.eclass: Block also pythonX.Y in wrappers Date: Sat, 8 Sep 2018 09:09:41 +0200 Message-Id: <20180908070941.23482-1-mgorny@gentoo.org> X-Mailer: git-send-email 2.19.0.rc2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 00908562-e934-4792-96d1-80255f1593b6 X-Archives-Hash: 1cb18302c2b38f827493475b104e7e92 Improve the wrapper blocking logic to block specific Python versions as well rather than just 2/3. In other words, for eselected pythonX.Y both pythonZ (Z = X^1) and python*.* (!= X.Y) will be blocked. Hopefully this will catch more build systems that hardcode Python versions rather than respecting what we're giving them. This will work only for build systems respecting PATH. Build systems (and ebuilds) using /usr/bin path directly will still be able to use other Python versions. --- eclass/python-utils-r1.eclass | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index e3cf82b4b58f..6bcbe2e5a09f 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -1043,11 +1043,21 @@ python_wrapper_setup() { nonsupp+=( 2to3 python-config "python${pyver}-config" ) fi + # block all other interpreters as incompatible + local orig_EPYTHON=${EPYTHON} local x + for x in "${_PYTHON_ALL_IMPLS[@]}"; do + python_export "${x}" EPYTHON + [[ ${EPYTHON} == ${orig_EPYTHON} ]] && continue + + nonsupp+=( "${EPYTHON}" ) + [[ ${EPYTHON} == python* ]] && nonsupp+=( "${EPYTHON}-config" ) + done + for x in "${nonsupp[@]}"; do cat >"${workdir}"/bin/${x} <<-_EOF_ || die #!/bin/sh - echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${EPYTHON} (PYTHON_COMPAT)" >&2 + echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${orig_EPYTHON} (PYTHON_COMPAT)" >&2 exit 127 _EOF_ chmod +x "${workdir}"/bin/${x} || die -- 2.19.0.rc2