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 144D9158091 for ; Tue, 7 Jun 2022 17:01:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 49BE3E0833; Tue, 7 Jun 2022 17:01:37 +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 2BBA7E0833 for ; Tue, 7 Jun 2022 17:01:37 +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) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1D2FD341A93 for ; Tue, 7 Jun 2022 17:01:36 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A847E471 for ; Tue, 7 Jun 2022 17:01:33 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1654621240.a7c1d9d5107cce52c19f638df5454ece9cbbcfa7.grobian@gentoo> Subject: [gentoo-commits] repo/proj/prefix:master commit in: eclass/ X-VCS-Repository: repo/proj/prefix X-VCS-Files: eclass/python-utils-r1.eclass X-VCS-Directories: eclass/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: a7c1d9d5107cce52c19f638df5454ece9cbbcfa7 X-VCS-Branch: master Date: Tue, 7 Jun 2022 17:01:33 +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: e08d661e-cce9-4202-ab78-af00c7953f23 X-Archives-Hash: 57ced2ebd442fa62766811763ee2fecb commit: a7c1d9d5107cce52c19f638df5454ece9cbbcfa7 Author: Fabian Groffen gentoo org> AuthorDate: Tue Jun 7 17:00:40 2022 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Tue Jun 7 17:00:40 2022 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=a7c1d9d5 python-utils-r1.eclass: sync from latest gx86, unbreak python pkgs Bug: https://bugs.gentoo.org/850406 Signed-off-by: Fabian Groffen gentoo.org> eclass/python-utils-r1.eclass | 55 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index b9102cd320..c50da71ac8 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -712,6 +712,9 @@ python_scriptinto() { python_doexe() { debug-print-function ${FUNCNAME} "${@}" + [[ ${EBUILD_PHASE} != install ]] && + die "${FUNCNAME} can only be used in src_install" + local f for f; do python_newexe "${f}" "${f##*/}" @@ -730,6 +733,8 @@ python_doexe() { python_newexe() { debug-print-function ${FUNCNAME} "${@}" + [[ ${EBUILD_PHASE} != install ]] && + die "${FUNCNAME} can only be used in src_install" [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} " @@ -778,6 +783,9 @@ python_newexe() { python_doscript() { debug-print-function ${FUNCNAME} "${@}" + [[ ${EBUILD_PHASE} != install ]] && + die "${FUNCNAME} can only be used in src_install" + local _PYTHON_REWRITE_SHEBANG=1 python_doexe "${@}" } @@ -802,6 +810,9 @@ python_doscript() { python_newscript() { debug-print-function ${FUNCNAME} "${@}" + [[ ${EBUILD_PHASE} != install ]] && + die "${FUNCNAME} can only be used in src_install" + local _PYTHON_REWRITE_SHEBANG=1 python_newexe "${@}" } @@ -821,10 +832,10 @@ python_newscript() { # site-packages directory. # # In the relative case, the exact path is determined directly -# by each python_doscript/python_newscript function. Therefore, -# python_moduleinto can be safely called before establishing the Python -# interpreter and/or a single call can be used to set the path correctly -# for multiple implementations, as can be seen in the following example. +# by each python_domodule invocation. Therefore, python_moduleinto +# can be safely called before establishing the Python interpreter and/or +# a single call can be used to set the path correctly for multiple +# implementations, as can be seen in the following example. # # Example: # @CODE @@ -848,6 +859,10 @@ python_moduleinto() { # and packages (directories). All listed files will be installed # for all enabled implementations, and compiled afterwards. # +# The files are installed into ${D} when run in src_install() phase. +# Otherwise, they are installed into ${BUILD_DIR}/install location +# that is suitable for picking up by distutils-r1 in PEP517 mode. +# # Example: # @CODE # src_install() { @@ -870,13 +885,24 @@ python_domodule() { d=${sitedir#${EPREFIX}}/${_PYTHON_MODULEROOT//.//} fi - ( - insopts -m 0644 - insinto "${d}" - doins -r "${@}" || return ${?} - ) - - python_optimize "${ED%/}/${d}" + if [[ ${EBUILD_PHASE} == install ]]; then + ( + insopts -m 0644 + insinto "${d}" + doins -r "${@}" || return ${?} + ) + python_optimize "${ED%/}/${d}" + elif [[ -n ${BUILD_DIR} ]]; then + local dest=${BUILD_DIR}/install${EPREFIX}/${d} + mkdir -p "${dest}" || die + cp -pR "${@}" "${dest}/" || die + ( + cd "${dest}" && + chmod -R a+rX "${@##*/}" + ) || die + else + die "${FUNCNAME} can only be used in src_install or with BUILD_DIR set" + fi } # @FUNCTION: python_doheader @@ -895,6 +921,8 @@ python_domodule() { python_doheader() { debug-print-function ${FUNCNAME} "${@}" + [[ ${EBUILD_PHASE} != install ]] && + die "${FUNCNAME} can only be used in src_install" [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' local includedir=$(python_get_includedir) @@ -1334,6 +1362,11 @@ epytest() { # remove common temporary directories left over by pytest plugins rm -rf .hypothesis .pytest_cache || die + # pytest plugins create additional .pyc files while testing + # see e.g. https://bugs.gentoo.org/847235 + if [[ -n ${BUILD_DIR} && -d ${BUILD_DIR} ]]; then + find "${BUILD_DIR}" -name '*-pytest-*.pyc' -delete || die + fi return ${ret} }