From 7d3a9e65df75b6a2567c668ce27f9082f36fa1c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 8 Jul 2022 08:22:13 +0200 Subject: [PATCH 01/17] virtualx.eclass: Add quoting to workaround vim syntax hl bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- eclass/virtualx.eclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass index b7a25c897b4ab..5c4b39164cff6 100644 --- a/eclass/virtualx.eclass +++ b/eclass/virtualx.eclass @@ -53,7 +53,7 @@ case ${VIRTUALX_REQUIRED} in *) BDEPEND="${VIRTUALX_REQUIRED}? ( ${VIRTUALX_DEPEND} )" IUSE="${VIRTUALX_REQUIRED}" - [[ ${VIRTUALX_REQUIRED} == test ]] && + [[ ${VIRTUALX_REQUIRED} == "test" ]] && RESTRICT+=" !test? ( test )" ;; esac From aa75351b53dbd55153b224bc97ea1fec141dc7c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 8 Jul 2022 08:26:50 +0200 Subject: [PATCH 02/17] virtualx.eclass: Pass xvfbargs as an array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- eclass/virtualx.eclass | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass index 5c4b39164cff6..d7b82e12cdd55 100644 --- a/eclass/virtualx.eclass +++ b/eclass/virtualx.eclass @@ -109,7 +109,7 @@ virtx() { local retval=0 local OLD_SANDBOX_ON="${SANDBOX_ON}" local XVFB XHOST XDISPLAY - local xvfbargs="-screen 0 1280x1024x24 +extension RANDR" + local xvfbargs=( -screen 0 1280x1024x24 +extension RANDR ) XVFB=$(type -p Xvfb) || die XHOST=$(type -p xhost) || die @@ -134,24 +134,24 @@ virtx() { # We really do not want SANDBOX enabled here export SANDBOX_ON="0" - debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs}" - ${XVFB} :${XDISPLAY} ${xvfbargs} &>/dev/null & + debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs[*]}" + ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null & sleep 2 local start=${XDISPLAY} while [[ ! -f /tmp/.X${XDISPLAY}-lock ]]; do # Stop trying after 15 tries if ((XDISPLAY - start > 15)) ; then - eerror "'${XVFB} :${XDISPLAY} ${xvfbargs}' returns:" + eerror "'${XVFB} :${XDISPLAY} ${xvfbargs[*]}' returns:" echo - ${XVFB} :${XDISPLAY} ${xvfbargs} + ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" echo eerror "If possible, correct the above error and try your emerge again." die "Unable to start Xvfb" fi ((XDISPLAY++)) - debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs}" - ${XVFB} :${XDISPLAY} ${xvfbargs} &>/dev/null & + debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs[*]}" + ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null & sleep 2 done From 4e2ffcee0451b9295e1bf358e8d33e2a33f09796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 8 Jul 2022 08:40:30 +0200 Subject: [PATCH 03/17] virtualx.eclass: Remove unused XHOST MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- eclass/virtualx.eclass | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass index d7b82e12cdd55..05b89e814a421 100644 --- a/eclass/virtualx.eclass +++ b/eclass/virtualx.eclass @@ -108,10 +108,9 @@ virtx() { local i=0 local retval=0 local OLD_SANDBOX_ON="${SANDBOX_ON}" - local XVFB XHOST XDISPLAY + local XVFB XDISPLAY local xvfbargs=( -screen 0 1280x1024x24 +extension RANDR ) XVFB=$(type -p Xvfb) || die - XHOST=$(type -p xhost) || die debug-print "${FUNCNAME}: running Xvfb hack" export XAUTHORITY= From 3020036e18b7408ea7f01ecac4eb09972466aa3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 8 Jul 2022 08:41:58 +0200 Subject: [PATCH 04/17] virtualx.eclass: Inline XVFB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- eclass/virtualx.eclass | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass index 05b89e814a421..d1c05e20b2464 100644 --- a/eclass/virtualx.eclass +++ b/eclass/virtualx.eclass @@ -108,9 +108,8 @@ virtx() { local i=0 local retval=0 local OLD_SANDBOX_ON="${SANDBOX_ON}" - local XVFB XDISPLAY + local XDISPLAY local xvfbargs=( -screen 0 1280x1024x24 +extension RANDR ) - XVFB=$(type -p Xvfb) || die debug-print "${FUNCNAME}: running Xvfb hack" export XAUTHORITY= @@ -133,24 +132,24 @@ virtx() { # We really do not want SANDBOX enabled here export SANDBOX_ON="0" - debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs[*]}" - ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null & + debug-print "${FUNCNAME}: Xvfb :${XDISPLAY} ${xvfbargs[*]}" + Xvfb :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null & sleep 2 local start=${XDISPLAY} while [[ ! -f /tmp/.X${XDISPLAY}-lock ]]; do # Stop trying after 15 tries if ((XDISPLAY - start > 15)) ; then - eerror "'${XVFB} :${XDISPLAY} ${xvfbargs[*]}' returns:" + eerror "'Xvfb :${XDISPLAY} ${xvfbargs[*]}' returns:" echo - ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" + Xvfb :${XDISPLAY} "${xvfbargs[@]}" echo eerror "If possible, correct the above error and try your emerge again." die "Unable to start Xvfb" fi ((XDISPLAY++)) - debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs[*]}" - ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null & + debug-print "${FUNCNAME}: Xvfb :${XDISPLAY} ${xvfbargs[*]}" + Xvfb :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null & sleep 2 done From 10811b0ace57ad1f1b725903a5164a1e733758a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 8 Jul 2022 09:08:48 +0200 Subject: [PATCH 05/17] virtualx.eclass: Let Xvfb figure out the free DISPLAY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the antiquated search mechanism for a free DISPLAY with Xvfb's -displayfd option that makes Xvfb choose one itself and print it to given fd. Bug: https://bugs.gentoo.org/494244 Signed-off-by: Michał Górny --- eclass/virtualx.eclass | 58 +++++++++++++----------------------------- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass index d1c05e20b2464..c0af095e89a55 100644 --- a/eclass/virtualx.eclass +++ b/eclass/virtualx.eclass @@ -108,65 +108,43 @@ virtx() { local i=0 local retval=0 local OLD_SANDBOX_ON="${SANDBOX_ON}" - local XDISPLAY local xvfbargs=( -screen 0 1280x1024x24 +extension RANDR ) debug-print "${FUNCNAME}: running Xvfb hack" export XAUTHORITY= - # The following is derived from Mandrake's hack to allow - # compiling without the X display - einfo "Scanning for an open DISPLAY to start Xvfb ..." - # If we are in a chrooted environment, and there is already a - # X server started outside of the chroot, Xvfb will fail to start - # on the same display (most cases this is :0 ), so make sure - # Xvfb is started, else bump the display number - # - # Azarah - 5 May 2002 - # GNOME GDM may have started X on DISPLAY :0 with a - # lock file /tmp/.X1024-lock, therefore start the search at 1. - # Else a leftover /tmp/.X1-lock will prevent finding an available display. - XDISPLAY=$(i=1; while [[ -f /tmp/.X${i}-lock ]] ; do ((i++));done; echo ${i}) - debug-print "${FUNCNAME}: XDISPLAY=${XDISPLAY}" + einfo "Starting Xvfb ..." # We really do not want SANDBOX enabled here export SANDBOX_ON="0" - debug-print "${FUNCNAME}: Xvfb :${XDISPLAY} ${xvfbargs[*]}" - Xvfb :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null & - sleep 2 + debug-print "${FUNCNAME}: Xvfb -displayfd 1 ${xvfbargs[*]}" + local logfile=${T}/Xvfb.log + local pidfile=${T}/Xvfb.pid + # NB: bash command substitution blocks until Xvfb prints fd to stdout + # and then closes the fd; only then it backgrounds properly + export DISPLAY=:$( + Xvfb -displayfd 1 "${xvfbargs[@]}" 2>"${logfile}" & + echo "$!" > "${pidfile}" + ) - local start=${XDISPLAY} - while [[ ! -f /tmp/.X${XDISPLAY}-lock ]]; do - # Stop trying after 15 tries - if ((XDISPLAY - start > 15)) ; then - eerror "'Xvfb :${XDISPLAY} ${xvfbargs[*]}' returns:" - echo - Xvfb :${XDISPLAY} "${xvfbargs[@]}" - echo - eerror "If possible, correct the above error and try your emerge again." - die "Unable to start Xvfb" - fi - ((XDISPLAY++)) - debug-print "${FUNCNAME}: Xvfb :${XDISPLAY} ${xvfbargs[*]}" - Xvfb :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null & - sleep 2 - done + if [[ ${DISPLAY} == : ]]; then + eerror "Xvfb failed to start, reprinting error log" + cat "${logfile}" + die "Xvfb failed to start" + fi # Now enable SANDBOX again if needed. export SANDBOX_ON="${OLD_SANDBOX_ON}" - einfo "Starting Xvfb on \$DISPLAY=${XDISPLAY} ..." - - export DISPLAY=:${XDISPLAY} - # Do not break on error, but setup $retval, as we need - # to kill Xvfb + # Do not break on error, but setup $retval, as we need to kill Xvfb + einfo "Xvfb started on DISPLAY=${DISPLAY}" debug-print "${FUNCNAME}: $@" nonfatal "$@" retval=$? # Now kill Xvfb - kill $(cat /tmp/.X${XDISPLAY}-lock) + kill "$(<"${pidfile}")" # die if our command failed [[ ${retval} -ne 0 ]] && die "Failed to run '$@'" From aa7fdc965621b413d85624ea30e9452a4130aced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Jul 2022 09:10:41 +0200 Subject: [PATCH 06/17] virtualx.eclass: Do not disable sandbox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code responsible for disabling sandbox dates back to 2002 and does not include any explanation. Let's try if we still need it. Bug: https://bugs.gentoo.org/107479 Signed-off-by: Michał Górny --- eclass/virtualx.eclass | 7 ------- 1 file changed, 7 deletions(-) diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass index c0af095e89a55..e04834d39bd1d 100644 --- a/eclass/virtualx.eclass +++ b/eclass/virtualx.eclass @@ -107,7 +107,6 @@ virtx() { local i=0 local retval=0 - local OLD_SANDBOX_ON="${SANDBOX_ON}" local xvfbargs=( -screen 0 1280x1024x24 +extension RANDR ) debug-print "${FUNCNAME}: running Xvfb hack" @@ -115,9 +114,6 @@ virtx() { einfo "Starting Xvfb ..." - # We really do not want SANDBOX enabled here - export SANDBOX_ON="0" - debug-print "${FUNCNAME}: Xvfb -displayfd 1 ${xvfbargs[*]}" local logfile=${T}/Xvfb.log local pidfile=${T}/Xvfb.pid @@ -134,9 +130,6 @@ virtx() { die "Xvfb failed to start" fi - # Now enable SANDBOX again if needed. - export SANDBOX_ON="${OLD_SANDBOX_ON}" - # Do not break on error, but setup $retval, as we need to kill Xvfb einfo "Xvfb started on DISPLAY=${DISPLAY}" debug-print "${FUNCNAME}: $@" From 7e2791da8da69126ad759103967ae99d16b093ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 18 Jul 2022 08:15:14 +0200 Subject: [PATCH 07/17] distutils-r1.eclass: Update pyproject.toml advice for PEP517 mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- eclass/distutils-r1.eclass | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index e64eedec5fd35..9909ba70178cb 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -884,10 +884,10 @@ _distutils-r1_handle_pyproject_toml() { if [[ ! -f setup.py && -f pyproject.toml ]]; then if [[ ${DISTUTILS_USE_SETUPTOOLS} != pyproject.toml ]]; then - eerror "No setup.py found but pyproject.toml is present. In order to enable" - eerror "pyproject.toml support in distutils-r1, set:" - eerror " DISTUTILS_USE_SETUPTOOLS=pyproject.toml" - die "No setup.py found and DISTUTILS_USE_SETUPTOOLS!=pyproject.toml" + eerror "No setup.py found but pyproject.toml is present. Please migrate" + eerror "the package to use DISTUTILS_USE_PEP517. See:" + eerror " https://projects.gentoo.org/python/guide/distutils.html" + die "No setup.py found and PEP517 mode not enabled" fi fi } From 77de20b0d60b530525bfa85aa0aeec4faa468653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Jul 2022 09:20:21 +0200 Subject: [PATCH 08/17] distutils-r1.eclass: Require gpep517 >= 8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- eclass/distutils-r1.eclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 9909ba70178cb..85a5c8496d498 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -205,7 +205,7 @@ _distutils_set_globals() { fi bdep=' - >=dev-python/gpep517-6[${PYTHON_USEDEP}] + >=dev-python/gpep517-8[${PYTHON_USEDEP}] ' case ${DISTUTILS_USE_PEP517} in flit) From a09934ce1b026924c173d535d06e55a3126add04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 18 Jul 2022 10:52:40 +0200 Subject: [PATCH 09/17] install-qa-check.d: Rewrite 60python-pyc to use gpep517 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- metadata/install-qa-check.d/60python-pyc | 168 +++++++++++++---------- 1 file changed, 96 insertions(+), 72 deletions(-) diff --git a/metadata/install-qa-check.d/60python-pyc b/metadata/install-qa-check.d/60python-pyc index 47e9a3eea9088..fd9434994f2fc 100644 --- a/metadata/install-qa-check.d/60python-pyc +++ b/metadata/install-qa-check.d/60python-pyc @@ -4,86 +4,110 @@ # QA check: ensure that Python modules are compiled after installing # Maintainer: Python project -# EAPI guard to prevent errors from trying to import python-utils-r1 -# in unsupported EAPIs. Please keep the list in sync with the eclass! -if [[ ${EAPI} == [6-8] ]]; then - inherit python-utils-r1 +python_pyc_check() { + local save=$(shopt -p nullglob) + shopt -s nullglob + local progs=( "${EPREFIX}"/usr/lib/python-exec/*/gpep517 ) + ${save} - python_pyc_check() { - local impl missing=() outdated=() - for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do - _python_export "${impl}" EPYTHON PYTHON - [[ -x ${PYTHON} ]] || continue - local sitedir=$(python_get_sitedir "${impl}") + local invalid=() + local mismatched_timestamp=() + local mismatched_data=() + local missing=() + local stray=() - if [[ -d ${D}${sitedir} ]]; then - local suffixes=() subdir= - case ${EPYTHON} in - python2*) - suffixes=( .py{c,o} ) - ;; - pypy) - suffixes=( .pyc ) - ;; - python3*|pypy3*) - local tag=$("${PYTHON}" -c 'import sys; print(sys.implementation.cache_tag)') - suffixes=( ".${tag}"{,.opt-{1,2}}.pyc ) - subdir=__pycache__/ - ;; - *) - # skip testing unknown impl - continue - ;; - esac + for prog in "${progs[@]}"; do + local impl=${prog%/*} + impl=${impl##*/} + einfo "Verifying compiled files for ${impl}" + local kind pyc py + while IFS=: read -r kind pyc py extra; do + case ${kind} in + invalid) + invalid+=( "${pyc}" ) + ;; + mismatched) + case ${extra} in + timestamp) + mismatched_timestamp+=( "${pyc}" ) + ;; + *) + mismatched_data+=( "${pyc}" ) + ;; + esac + ;; + missing) + missing+=( "${pyc}" ) + ;; + older) + # older warnings were produced by earlier version + # of gpep517 but the check was incorrect, so we just + # ignore them + ;; + stray) + stray+=( "${pyc}" ) + ;; + esac + done < <("${prog}" verify-pyc --destdir "${D}" --prefix "${EPREFIX}"/usr) + done - einfo "Verifying compiled files in ${sitedir}" - local f s - while read -d $'\0' -r f; do - local dir=${f%/*} - local basename=${f##*/} - basename=${basename%.py} + local found= + if [[ ${missing[@]} ]]; then + eqawarn + eqawarn "QA Notice: This package installs one or more Python modules that are" + eqawarn "not byte-compiled." + eqawarn "The following files are missing:" + eqawarn + eqatag -v python-pyc.missing "${missing[@]}" + found=1 + fi - for s in "${suffixes[@]}"; do - local cache=${dir}/${subdir}${basename}${s} - if [[ ! -f ${cache} ]]; then - missing+=( "${cache}" ) - elif [[ ${f} -nt ${cache} ]]; then - outdated+=( "${cache}" ) - fi - done - done < <(find "${D}${sitedir}" -name '*.py' -print0) - fi - done + if [[ ${invalid[@]} ]]; then + eqawarn + eqawarn "QA Notice: This package installs one or more compiled Python modules" + eqawarn "that seem to be invalid (do not have the correct header)." + eqawarn "The following files are invalid:" + eqawarn + eqatag -v python-pyc.invalid "${invalid[@]}" + found=1 + fi - if [[ ${missing[@]} ]]; then - eqawarn - eqawarn "QA Notice: This package installs one or more Python modules that are" - eqawarn "not byte-compiled." - eqawarn "The following files are missing:" - eqawarn - eqatag -v python-pyc.missing "${missing[@]#${D}}" - fi + if [[ ${mismatched_data[@]} ]]; then + eqawarn + eqawarn "QA Notice: This package installs one or more compiled Python modules whose" + eqawarn ".py files have different content (size or hash) than recorded:" + eqawarn + eqatag -v python-pyc.mismatched.data "${mismatched_data[@]}" + found=1 + fi - if [[ ${outdated[@]} ]]; then - eqawarn - eqawarn "QA Notice: This package installs one or more compiled Python modules that have" - eqawarn "older timestamps than the corresponding source files:" - eqawarn - eqatag -v python-pyc.outdated "${outdated[@]#${D}}" - fi + if [[ ${mismatched_timestamp[@]} ]]; then + eqawarn + eqawarn "QA Notice: This package installs one or more compiled Python modules whose" + eqawarn ".py files have different timestamps than recorded:" + eqawarn + eqatag -v python-pyc.mismatched.timestamp "${mismatched_timestamp[@]}" + found=1 + fi - if [[ ${missing[@]} || ${outdated[@]} ]]; then - eqawarn - eqawarn "Please either fix the upstream build system to byte-compile Python modules" - eqawarn "correctly, or call python_optimize after installing them. For more" - eqawarn "information, see:" - eqawarn "https://projects.gentoo.org/python/guide/helper.html#byte-compiling-python-modules" - eqawarn - fi - } + if [[ ${stray[@]} ]]; then + eqawarn + eqawarn "QA Notice: This package installs one or more compiled Python modules" + eqawarn "that do not match installed modules (or their implementation)." + eqawarn "The following files are stray:" + eqawarn + eqatag -v python-pyc.stray "${stray[@]}" + found=1 + fi - python_pyc_check -fi + if [[ ${found} ]]; then + eqawarn + eqawarn "For more information on bytecode files and related issues, please see:" + eqawarn " https://projects.gentoo.org/python/guide/qawarn.html#compiled-bytecode-related-warnings" + fi +} + +python_pyc_check : # guarantee successful exit From a0bcdd294d0d6a420c391986c20c16c23c82e4ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Jul 2022 09:20:57 +0200 Subject: [PATCH 10/17] distutils-r1.eclass: Bump dev-python/sip dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: https://bugs.gentoo.org/851840 Signed-off-by: Michał Górny --- eclass/distutils-r1.eclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 85a5c8496d498..e4ef1919bc7de 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -265,7 +265,7 @@ _distutils_set_globals() { ;; sip) bdep+=' - >=dev-python/sip-6.6.1[${PYTHON_USEDEP}] + >=dev-python/sip-6.6.2[${PYTHON_USEDEP}] ' ;; standalone) From 29688d65fff70633e97759018d52993d59ee8e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Jul 2022 09:44:52 +0200 Subject: [PATCH 11/17] distutils-r1.eclass: Pass EPREFIX to addpredict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pointed out by Arfrever. Signed-off-by: Michał Górny --- eclass/distutils-r1.eclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index e4ef1919bc7de..495eead1d5fdc 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -1647,8 +1647,8 @@ distutils-r1_python_install() { # python likes to compile any module it sees, which triggers sandbox # failures if some packages haven't compiled their modules yet. addpredict "${EPREFIX}/usr/lib/${EPYTHON}" - addpredict /usr/lib/pypy3.9 - addpredict /usr/local # bug 498232 + addpredict "${EPREFIX}/usr/lib/pypy3.9" + addpredict "${EPREFIX}/usr/local" # bug 498232 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then merge_root=1 From 1746fd5774b828411e4feacf80b9bf8029d7fb43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Jul 2022 09:52:22 +0200 Subject: [PATCH 12/17] distutils-r1.eclass: Let gpep517 compile bytecode when 9+ is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the new --optimize option of gpep517 >= 9 when it is installed, and remove the python_optimize call then. This conditional logic is meant to give some additional testing while gpep517-9 is still in ~arch. Note that this also removes python_optimize call for "no" mode. However, this mode is used only by a handful of ebuilds, so if any of them needs an explicit python_optimize call, we can quickly fix them. Signed-off-by: Michał Górny --- eclass/distutils-r1.eclass | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 495eead1d5fdc..60f81473c0a6a 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -1270,13 +1270,25 @@ distutils_wheel_install() { local wheel=${2} einfo " Installing ${wheel##*/} to ${root}" - local cmd=( - gpep517 install-wheel - --destdir="${root}" - --interpreter="${PYTHON}" - --prefix="${EPREFIX}/usr" - "${wheel}" - ) + if has_version -b ">=dev-python/gpep517-9"; then + # TODO: inline when we dep on >=9 + local cmd=( + gpep517 install-wheel + --destdir="${root}" + --interpreter="${PYTHON}" + --prefix="${EPREFIX}/usr" + --optimize=all + "${wheel}" + ) + else + local cmd=( + gpep517 install-wheel + --destdir="${root}" + --interpreter="${PYTHON}" + --prefix="${EPREFIX}/usr" + "${wheel}" + ) + fi printf '%s\n' "${cmd[*]}" "${cmd[@]}" || die "Wheel install failed" @@ -1994,9 +2006,13 @@ _distutils-r1_post_python_install() { done if [[ ${DISTUTILS_USE_PEP517} ]]; then - # we need to recompile everything here in order to embed - # the correct paths - python_optimize "${sitedir}" + if ! has_version -b ">=dev-python/gpep517-9" + then + # TODO: remove when we dep on >=9 + # we need to recompile everything here in order to embed + # the correct paths + python_optimize "${sitedir}" + fi fi fi } From cf8733d2fcb656b7a9242812874bc061a9341961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Jul 2022 10:18:07 +0200 Subject: [PATCH 13/17] dev-python/installer: Call python_optimize explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- dev-python/installer/installer-0.5.1-r1.ebuild | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dev-python/installer/installer-0.5.1-r1.ebuild b/dev-python/installer/installer-0.5.1-r1.ebuild index a29b236242cad..39b7336c9b898 100644 --- a/dev-python/installer/installer-0.5.1-r1.ebuild +++ b/dev-python/installer/installer-0.5.1-r1.ebuild @@ -35,3 +35,8 @@ distutils_enable_tests pytest python_compile() { python_domodule src/installer "${WORKDIR}"/*.dist-info } + +python_install() { + distutils-r1_python_install + python_optimize +} From 60441e61cfeb7d5e0fa85d4ee594753594efd2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Jul 2022 10:19:09 +0200 Subject: [PATCH 14/17] dev-python/tomli: Call python_optimize explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- dev-python/tomli/tomli-2.0.1-r1.ebuild | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dev-python/tomli/tomli-2.0.1-r1.ebuild b/dev-python/tomli/tomli-2.0.1-r1.ebuild index f24193c0c9fec..4a4c0bc1ea179 100644 --- a/dev-python/tomli/tomli-2.0.1-r1.ebuild +++ b/dev-python/tomli/tomli-2.0.1-r1.ebuild @@ -34,3 +34,8 @@ distutils_enable_tests unittest python_compile() { python_domodule src/tomli "${WORKDIR}"/*.dist-info } + +python_install() { + distutils-r1_python_install + python_optimize +} From 694d9d319c313b160fbb3fea155f9c7d5bd706ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Jul 2022 10:32:26 +0200 Subject: [PATCH 15/17] net-wireless/blueman: Invoke eautomake to fix py-compile script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- net-wireless/blueman/blueman-2.3.1.ebuild | 2 +- net-wireless/blueman/blueman-2.3.2.ebuild | 11 ++++++++--- net-wireless/blueman/blueman-9999.ebuild | 11 ++++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/net-wireless/blueman/blueman-2.3.1.ebuild b/net-wireless/blueman/blueman-2.3.1.ebuild index dbedcfc7eae65..997963609ec25 100644 --- a/net-wireless/blueman/blueman-2.3.1.ebuild +++ b/net-wireless/blueman/blueman-2.3.1.ebuild @@ -97,7 +97,7 @@ pkg_setup() { } src_prepare() { - [[ ${PV} == 9999 ]] && eautoreconf + [[ ${PV} == 9999 ]] && eautoreconf || eautomake distutils-r1_src_prepare } diff --git a/net-wireless/blueman/blueman-2.3.2.ebuild b/net-wireless/blueman/blueman-2.3.2.ebuild index 453fb6b604da2..c34ce0ed11612 100644 --- a/net-wireless/blueman/blueman-2.3.2.ebuild +++ b/net-wireless/blueman/blueman-2.3.2.ebuild @@ -7,13 +7,13 @@ DISTUTILS_SINGLE_IMPL=1 DISTUTILS_USE_PEP517=no PYTHON_COMPAT=( python3_{8..11} ) -inherit distutils-r1 gnome2-utils linux-info systemd xdg-utils +inherit autotools distutils-r1 gnome2-utils linux-info systemd xdg-utils DESCRIPTION="Simple and intuitive GTK+ Bluetooth Manager" HOMEPAGE="https://github.com/blueman-project/blueman/" if [[ ${PV} == "9999" ]] ; then - inherit autotools git-r3 + inherit git-r3 EGIT_REPO_URI="https://github.com/blueman-project/blueman.git" else SRC_URI=" @@ -97,7 +97,12 @@ pkg_setup() { } src_prepare() { - [[ ${PV} == 9999 ]] && eautoreconf + if [[ ${PV} == 9999 ]]; then + eautoreconf + else + # remove this when upstream switches to automake with .pyc fix + eautomake + fi distutils-r1_src_prepare } diff --git a/net-wireless/blueman/blueman-9999.ebuild b/net-wireless/blueman/blueman-9999.ebuild index 453fb6b604da2..c34ce0ed11612 100644 --- a/net-wireless/blueman/blueman-9999.ebuild +++ b/net-wireless/blueman/blueman-9999.ebuild @@ -7,13 +7,13 @@ DISTUTILS_SINGLE_IMPL=1 DISTUTILS_USE_PEP517=no PYTHON_COMPAT=( python3_{8..11} ) -inherit distutils-r1 gnome2-utils linux-info systemd xdg-utils +inherit autotools distutils-r1 gnome2-utils linux-info systemd xdg-utils DESCRIPTION="Simple and intuitive GTK+ Bluetooth Manager" HOMEPAGE="https://github.com/blueman-project/blueman/" if [[ ${PV} == "9999" ]] ; then - inherit autotools git-r3 + inherit git-r3 EGIT_REPO_URI="https://github.com/blueman-project/blueman.git" else SRC_URI=" @@ -97,7 +97,12 @@ pkg_setup() { } src_prepare() { - [[ ${PV} == 9999 ]] && eautoreconf + if [[ ${PV} == 9999 ]]; then + eautoreconf + else + # remove this when upstream switches to automake with .pyc fix + eautomake + fi distutils-r1_src_prepare } From 11a473895fa5886d6ce5897f14091149b577546f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Jul 2022 10:48:39 +0200 Subject: [PATCH 16/17] dev-python/pygobject: Call python_optimize explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- dev-python/pygobject/pygobject-3.42.2.ebuild | 1 + 1 file changed, 1 insertion(+) diff --git a/dev-python/pygobject/pygobject-3.42.2.ebuild b/dev-python/pygobject/pygobject-3.42.2.ebuild index 217ae21f2c4a6..d411290d75206 100644 --- a/dev-python/pygobject/pygobject-3.42.2.ebuild +++ b/dev-python/pygobject/pygobject-3.42.2.ebuild @@ -65,6 +65,7 @@ python_test() { python_install() { meson_src_install + python_optimize } python_install_all() { From 56b2e99542512e4fa17c5531d5b6432cc9080e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 28 Jul 2022 10:22:09 +0200 Subject: [PATCH 17/17] python-utils-r1.eclass: Sterilize pytest-sugar plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- eclass/python-utils-r1.eclass | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index b793a1f13e0fa..89013591c31b4 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -1331,6 +1331,9 @@ epytest() { # sterilize pytest-markdown as it runs code snippets from all # *.md files found without any warning -p no:markdown + # pytest-sugar undoes everything that's good about pytest output + # and makes it hard to read logs + -p no:sugar ) local x for x in "${EPYTEST_DESELECT[@]}"; do