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 F324F15803E for ; Sat, 6 Jan 2024 13:46:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2A1C42BC108; Sat, 6 Jan 2024 13:45:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.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)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8F46D2BC101 for ; Sat, 6 Jan 2024 13:45:01 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 8/9] install-qa-check.d/60python-site: Check for out-of-sitepkg install Date: Sat, 6 Jan 2024 14:44:45 +0100 Message-ID: <20240106134446.26153-8-mgorny@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106134446.26153-1-mgorny@gentoo.org> References: <20240106134446.26153-1-mgorny@gentoo.org> 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 X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 24d66d5d-7e85-4b4d-b827-c37fddf54052 X-Archives-Hash: c554cb39965886613f2845e5816cb574 Signed-off-by: Michał Górny --- metadata/install-qa-check.d/60python-site | 28 ++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/metadata/install-qa-check.d/60python-site b/metadata/install-qa-check.d/60python-site index 26f26d6cc527..cb31c7f98e08 100644 --- a/metadata/install-qa-check.d/60python-site +++ b/metadata/install-qa-check.d/60python-site @@ -31,6 +31,7 @@ python_site_check() { local stray=() local bad_versions=() + local outside_site=() local stray_packages=() # Avoid running the check if sufficiently new gpep517 is not installed @@ -46,7 +47,24 @@ python_site_check() { impl=${impl##*/} # NB: using ${impl}* to catch pypy3.* for pypy3 - local sitedir=( "${ED}"/usr/lib/${impl}*/site-packages ) + local pydir=( "${ED}"/usr/lib/${impl}* ) + [[ -d ${pydir} ]] || continue + + # check for packages installing outside site-packages + case ${CATEGORY}/${PN} in + dev-lang/python|dev-python/pypy*) + ;; + *) + while IFS= read -d $'\0' -r f; do + outside_site+=( "${f}" ) + done < <( + find "${pydir}" -mindepth 1 -maxdepth 1 \ + '!' -name site-packages -print0 + ) + ;; + esac + + local sitedir=( "${pydir}"/site-packages ) [[ -d ${sitedir} ]] || continue # check for bad package versions @@ -195,6 +213,14 @@ python_site_check() { eqawarn eqatag -v python-site.libdir "${bad_libdirs[@]#${ED}}" fi + + if [[ ${outside_site[@]} ]]; then + eqawarn + eqawarn "QA Notice: Files found installed directly into Python stdlib," + eqawarn "instead of site-packages (use \$(python_get_sitedir)):" + eqawarn + eqatag -v python-site.stdlib "${outside_site[@]}" + fi } python_site_check -- 2.43.0