summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRepository mirror & CI <repomirrorci@gentoo.org>2022-08-02 04:17:23 +0000
committerRepository mirror & CI <repomirrorci@gentoo.org>2022-08-02 04:17:23 +0000
commit717647cf9b1ca25bf5e75ea19e4b5b948a9e8367 (patch)
tree20369aa14b379e3b253b0385d254a183ca51c46b
parentMerge updates from master (diff)
parentpython-utils-r1.eclass: Sterilize pytest-sugar plugin (diff)
downloadgentoo-717647cf9b1ca25bf5e75ea19e4b5b948a9e8367.tar.gz
gentoo-717647cf9b1ca25bf5e75ea19e4b5b948a9e8367.tar.bz2
gentoo-717647cf9b1ca25bf5e75ea19e4b5b948a9e8367.zip
Merge updates from master
-rw-r--r--dev-python/installer/installer-0.5.1-r1.ebuild5
-rw-r--r--dev-python/pygobject/pygobject-3.42.2.ebuild1
-rw-r--r--dev-python/tomli/tomli-2.0.1-r1.ebuild5
-rw-r--r--eclass/distutils-r1.eclass52
-rw-r--r--eclass/python-utils-r1.eclass3
-rw-r--r--eclass/virtualx.eclass79
-rw-r--r--metadata/install-qa-check.d/60python-pyc168
-rw-r--r--net-wireless/blueman/blueman-2.3.1.ebuild2
-rw-r--r--net-wireless/blueman/blueman-2.3.2.ebuild11
-rw-r--r--net-wireless/blueman/blueman-9999.ebuild11
10 files changed, 185 insertions, 152 deletions
diff --git a/dev-python/installer/installer-0.5.1-r1.ebuild b/dev-python/installer/installer-0.5.1-r1.ebuild
index a29b236242ca..39b7336c9b89 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
+}
diff --git a/dev-python/pygobject/pygobject-3.42.2.ebuild b/dev-python/pygobject/pygobject-3.42.2.ebuild
index 217ae21f2c4a..d411290d7520 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() {
diff --git a/dev-python/tomli/tomli-2.0.1-r1.ebuild b/dev-python/tomli/tomli-2.0.1-r1.ebuild
index f24193c0c9fe..4a4c0bc1ea17 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
+}
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 '$@'"
diff --git a/metadata/install-qa-check.d/60python-pyc b/metadata/install-qa-check.d/60python-pyc
index 47e9a3eea908..fd9434994f2f 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 <python@gentoo.org>
-# 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
diff --git a/net-wireless/blueman/blueman-2.3.1.ebuild b/net-wireless/blueman/blueman-2.3.1.ebuild
index dbedcfc7eae6..997963609ec2 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 453fb6b604da..c34ce0ed1161 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 453fb6b604da..c34ce0ed1161 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
}