From e594c992ffc7a67aab370bfe0634d498dbd82b8a Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 2 Aug 2022 09:17:58 +0100 Subject: gentoo auto-resync : 02:08:2022 - 09:17:58 --- eclass/Manifest.gz | Bin 36826 -> 36821 bytes eclass/distutils-r1.eclass | 52 +++++++++++++++++---------- eclass/python-utils-r1.eclass | 3 ++ eclass/virtualx.eclass | 79 +++++++++++++----------------------------- 4 files changed, 61 insertions(+), 73 deletions(-) (limited to 'eclass') diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz index 22e1abe3e97c..6adb563c8214 100644 Binary files a/eclass/Manifest.gz and b/eclass/Manifest.gz differ diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index e64eedec5fd3..60f81473c0a6 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) @@ -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) @@ -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 } @@ -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" @@ -1647,8 +1659,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 @@ -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 } diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index b793a1f13e0f..89013591c31b 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 diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass index b7a25c897b4a..e04834d39bd1 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 @@ -107,68 +107,37 @@ virtx() { local i=0 local retval=0 - local OLD_SANDBOX_ON="${SANDBOX_ON}" - local XVFB XHOST XDISPLAY - local xvfbargs="-screen 0 1280x1024x24 +extension RANDR" - XVFB=$(type -p Xvfb) || die - XHOST=$(type -p xhost) || die + 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}" - - # 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 - - 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 - - # 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 + + einfo "Starting Xvfb ..." + + 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}" + ) + + if [[ ${DISPLAY} == : ]]; then + eerror "Xvfb failed to start, reprinting error log" + cat "${logfile}" + die "Xvfb failed to start" + fi + + # 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 '$@'" -- cgit v1.2.3