Merge updates from master

This commit is contained in:
Repository mirror & CI
2022-08-02 04:17:23 +00:00
10 changed files with 181 additions and 148 deletions

View File

@@ -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
}

View File

@@ -65,6 +65,7 @@ python_test() {
python_install() {
meson_src_install
python_optimize
}
python_install_all() {

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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

View File

@@ -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}"
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
# 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}"
)
debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs}"
${XVFB} :${XDISPLAY} ${xvfbargs} &>/dev/null &
sleep 2
if [[ ${DISPLAY} == : ]]; then
eerror "Xvfb failed to start, reprinting error log"
cat "${logfile}"
die "Xvfb failed to start"
fi
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
# 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 '$@'"

View File

@@ -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

View File

@@ -97,7 +97,7 @@ pkg_setup() {
}
src_prepare() {
[[ ${PV} == 9999 ]] && eautoreconf
[[ ${PV} == 9999 ]] && eautoreconf || eautomake
distutils-r1_src_prepare
}

View File

@@ -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
}

View File

@@ -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
}