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 21464138359 for ; Mon, 21 Sep 2020 15:30:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4EE00E0829; Mon, 21 Sep 2020 15:30:23 +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 2FC63E0829 for ; Mon, 21 Sep 2020 15:30:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 21733335DA7 for ; Mon, 21 Sep 2020 15:30:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7D1DB2EE for ; Mon, 21 Sep 2020 15:30:19 +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: <1600702201.9520fd88a9f8f9a8141e51a53305a5ee13195bd8.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: metadata/install-qa-check.d/ X-VCS-Repository: repo/gentoo X-VCS-Files: metadata/install-qa-check.d/60distutils-use-setuptools X-VCS-Directories: metadata/install-qa-check.d/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 9520fd88a9f8f9a8141e51a53305a5ee13195bd8 X-VCS-Branch: master Date: Mon, 21 Sep 2020 15:30:19 +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: 3af2a803-4734-47f8-9deb-44c640225720 X-Archives-Hash: aeaa9afeb6ca5aec5a23ff39cb72171e commit: 9520fd88a9f8f9a8141e51a53305a5ee13195bd8 Author: Michał Górny gentoo org> AuthorDate: Fri Sep 18 20:37:55 2020 +0000 Commit: Michał Górny gentoo org> CommitDate: Mon Sep 21 15:30:01 2020 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9520fd88 install-qa-check.d: add DISTUTILS_USE_SETUPTOOLS check Move DISTUTILS_USE_SETUPTOOLS check from distutils-r1.eclass to install QA checks, and rewrite it to use installed egg-info rather than greps on input files. This produces less false positives, particularly in packages that use boilerplate empty 'entry_points' in their setup script or configuration file. We also no longer require explicit setuptools RDEPEND for packages using other entry point types than console_scripts -- instead, we assume that the package consuming these entry points will bring setuptools as necessary. The rough idea is to look at egg-info metadata installed by distutils or setuptools. Plain distutils installs it as a regular file, while setuptools as a directory, and that's how we distinguish the two. For setuptools, we additionally grep entry_points.txt for `[console_scripts]`, and require RDEPEND when they are present. Signed-off-by: Michał Górny gentoo.org> .../install-qa-check.d/60distutils-use-setuptools | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/metadata/install-qa-check.d/60distutils-use-setuptools b/metadata/install-qa-check.d/60distutils-use-setuptools new file mode 100644 index 00000000000..db07212cce4 --- /dev/null +++ b/metadata/install-qa-check.d/60distutils-use-setuptools @@ -0,0 +1,60 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# QA check: verify correctness of DISTUTILS_USE_SETUPTOOLS +# Maintainer: Python project + +get_expected_distutils_use_setuptools() { + local sitedir=${D}$(python_get_sitedir) + local egg new_expected + while read -d $'\0' -r egg; do + if [[ -f ${egg} ]]; then + # if .egg-info is a file, it's plain distutils + new_expected=no + elif grep -q -s -F '[console_scripts]' "${egg}"/entry_points.txt + then + # entry_points == we need rdepend + new_expected=rdepend + else + new_expected=bdepend + fi + + if [[ ${expected} && ${new_expected} != ${expected} ]]; then + expected=integrity-error + else + expected=${new_expected} + fi + done < <(find "${sitedir}" -name '*.egg-info' -print0) +} + +distutils_use_setuptools_check() { + # applicable only to ebuilds inheriting distutils-r1 + [[ ${_DISTUTILS_R1} ]] || return + # 'manual' means no checking + [[ ${DISTUTILS_USE_SETUPTOOLS} == manual ]] && return + # pyproject.toml is verified by using it + [[ ${DISTUTILS_USE_SETUPTOOLS} == pyproject.toml ]] && return + + local expected + _distutils-r1_run_foreach_impl get_expected_distutils_use_setuptools + + if [[ ${expected} == integrity-error ]]; then + eerror "DISTUTILS_USE_SETUPTOOLS integrity error!" + eerror "expected was: ${expected}" + eerror "new_expected is: ${new_expected}" + eerror "Please report a bug about this and CC python@" + elif [[ ${DISTUTILS_USE_SETUPTOOLS} != ${expected} ]]; then + local def= + [[ ${DISTUTILS_USE_SETUPTOOLS} == bdepend ]] && def=' (or unset)' + + eqawarn "DISTUTILS_USE_SETUPTOOLS value is probably incorrect" + eqawarn " have: DISTUTILS_USE_SETUPTOOLS=${DISTUTILS_USE_SETUPTOOLS}${def}" + eqawarn " expected: DISTUTILS_USE_SETUPTOOLS=${expected}" + fi +} + +distutils_use_setuptools_check + +: # guarantee successful exit + +# vim:ft=ebuild