* [gentoo-dev] [PATCH 0/5] distutils-r1 & python-utils-r1: cleanup old stuff
@ 2022-12-08 18:53 Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 1/5] distutils-r1.eclass: Require meson-python >= 0.11.0 Michał Górny
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Michał Górny @ 2022-12-08 18:53 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Hi,
Here's a short series of patches to clean some obsolete stuff:
a. support for meson-python < 0.11.0 (that did not provide the ability
to pass meson options)
b. support for EAPI 6 in distutils-r1 (no longer used in ::gentoo)
c. conditional support for python2_7 in python-any-r1 (likewise)
d. unused code related to support for old Python versions
While at it, I've also noticed that we're applying wrong (python3.8 era)
python_optimize logic to PyPy3.9.
--
Best regards,
Michał Górny
Michał Górny (5):
distutils-r1.eclass: Require meson-python >= 0.11.0
distutils-r1.eclass: Remove EAPI 6 support
python-any-r1.eclass: Stop allowing python2_7
python-utils-r1.eclass: Clean up post disabling python2_7 compat
python-utils-r1.eclass: Update python_optimize for PyPy3.9
eclass/distutils-r1.eclass | 85 +++++++++++++----------------------
eclass/python-any-r1.eclass | 1 -
eclass/python-utils-r1.eclass | 68 +++++++++-------------------
3 files changed, 51 insertions(+), 103 deletions(-)
--
2.38.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gentoo-dev] [PATCH 1/5] distutils-r1.eclass: Require meson-python >= 0.11.0
2022-12-08 18:53 [gentoo-dev] [PATCH 0/5] distutils-r1 & python-utils-r1: cleanup old stuff Michał Górny
@ 2022-12-08 18:53 ` Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 2/5] distutils-r1.eclass: Remove EAPI 6 support Michał Górny
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2022-12-08 18:53 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 43 +++++++++++++++++---------------------
1 file changed, 19 insertions(+), 24 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 97c5e562bc0f..65004ba856f9 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -236,7 +236,7 @@ _distutils_set_globals() {
;;
meson-python)
bdep+='
- >=dev-python/meson-python-0.10.0-r1[${PYTHON_USEDEP}]
+ >=dev-python/meson-python-0.11.0[${PYTHON_USEDEP}]
'
;;
pbr)
@@ -1312,29 +1312,24 @@ distutils_pep517_install() {
local config_settings=
case ${DISTUTILS_USE_PEP517} in
meson-python)
- # TODO: remove the condition once we BDEP on >=0.11
- if has_version -b ">=dev-python/meson-python-0.11"; then
- local -x NINJAOPTS=$(get_NINJAOPTS)
- config_settings=$(
- "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die
- import json
- import os
- import shlex
- import sys
-
- ninjaopts = shlex.split(os.environ["NINJAOPTS"])
- print(json.dumps({
- "setup-args": sys.argv[1:],
- "compile-args": [
- "-v",
- f"--ninja-args={ninjaopts!r}",
- ],
- }))
- EOF
- )
- elif [[ -n ${DISTUTILS_ARGS[@]} ]]; then
- die "DISTUTILS_ARGS requires >=dev-python/meson-python-0.11 (missing BDEP?)"
- fi
+ local -x NINJAOPTS=$(get_NINJAOPTS)
+ config_settings=$(
+ "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die
+ import json
+ import os
+ import shlex
+ import sys
+
+ ninjaopts = shlex.split(os.environ["NINJAOPTS"])
+ print(json.dumps({
+ "setup-args": sys.argv[1:],
+ "compile-args": [
+ "-v",
+ f"--ninja-args={ninjaopts!r}",
+ ],
+ }))
+ EOF
+ )
;;
setuptools)
if [[ -n ${DISTUTILS_ARGS[@]} ]]; then
--
2.38.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-dev] [PATCH 2/5] distutils-r1.eclass: Remove EAPI 6 support
2022-12-08 18:53 [gentoo-dev] [PATCH 0/5] distutils-r1 & python-utils-r1: cleanup old stuff Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 1/5] distutils-r1.eclass: Require meson-python >= 0.11.0 Michał Górny
@ 2022-12-08 18:53 ` Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 3/5] python-any-r1.eclass: Stop allowing python2_7 Michał Górny
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2022-12-08 18:53 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 42 ++++++++++----------------------------
1 file changed, 11 insertions(+), 31 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 65004ba856f9..3064ba6a446c 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -7,7 +7,7 @@
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
# Based on the work of: Krzysztof Pawlik <nelchael@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @PROVIDES: python-r1 python-single-r1
# @BLURB: A simple eclass to build Python packages using distutils.
# @DESCRIPTION:
@@ -44,15 +44,9 @@
# For more information, please see the Python Guide:
# https://projects.gentoo.org/python/guide/
-case "${EAPI:-0}" in
- [0-5])
- die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
- ;;
- [6-8])
- ;;
- *)
- die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
- ;;
+case ${EAPI:-0} in
+ 7|8) ;;
+ *) die "EAPI=${EAPI:-0} not supported";;
esac
# @ECLASS_VARIABLE: DISTUTILS_OPTIONAL
@@ -177,7 +171,6 @@ esac
if [[ ! ${_DISTUTILS_R1} ]]; then
-[[ ${EAPI} == 6 ]] && inherit eutils xdg-utils
inherit multibuild multiprocessing ninja-utils toolchain-funcs
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
@@ -322,11 +315,7 @@ _distutils_set_globals() {
if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
RDEPEND="${PYTHON_DEPS} ${rdep}"
- if [[ ${EAPI} != 6 ]]; then
- BDEPEND="${PYTHON_DEPS} ${bdep}"
- else
- DEPEND="${PYTHON_DEPS} ${bdep}"
- fi
+ BDEPEND="${PYTHON_DEPS} ${bdep}"
REQUIRED_USE=${PYTHON_REQUIRED_USE}
fi
}
@@ -539,11 +528,7 @@ distutils_enable_sphinx() {
python_compile_all() { sphinx_compile_all; }
IUSE+=" doc"
- if [[ ${EAPI} == 6 ]]; then
- DEPEND+=" doc? ( ${deps} )"
- else
- BDEPEND+=" doc? ( ${deps} )"
- fi
+ BDEPEND+=" doc? ( ${deps} )"
# we need to ensure successful return in case we're called last,
# otherwise Portage may wrongly assume sourcing failed
@@ -624,11 +609,7 @@ distutils_enable_tests() {
if [[ -n ${test_deps} ]]; then
IUSE+=" test"
RESTRICT+=" !test? ( test )"
- if [[ ${EAPI} == 6 ]]; then
- DEPEND+=" test? ( ${test_deps} )"
- else
- BDEPEND+=" test? ( ${test_deps} )"
- fi
+ BDEPEND+=" test? ( ${test_deps} )"
fi
# we need to ensure successful return in case we're called last,
@@ -672,7 +653,7 @@ esetup.py() {
setup_py=( -c "from setuptools import setup; setup()" )
fi
- if [[ ${EAPI} != [67] && ${mydistutilsargs[@]} ]]; then
+ if [[ ${EAPI} != 7 && ${mydistutilsargs[@]} ]]; then
die "mydistutilsargs is banned in EAPI ${EAPI} (use DISTUTILS_ARGS)"
fi
@@ -744,7 +725,7 @@ distutils_install_for_testing() {
local install_method=root
case ${1} in
--via-home)
- [[ ${EAPI} == [67] ]] || die "${*} is banned in EAPI ${EAPI}"
+ [[ ${EAPI} == 7 ]] || die "${*} is banned in EAPI ${EAPI}"
install_method=home
shift
;;
@@ -895,7 +876,7 @@ _distutils-r1_check_all_phase_mismatch() {
eqawarn "QA Notice: distutils-r1_python_${EBUILD_PHASE}_all called"
eqawarn "from python_${EBUILD_PHASE}. Did you mean to use"
eqawarn "python_${EBUILD_PHASE}_all()?"
- [[ ${EAPI} != [67] ]] &&
+ [[ ${EAPI} != 7 ]] &&
die "distutils-r1_python_${EBUILD_PHASE}_all called from python_${EBUILD_PHASE}."
fi
}
@@ -1050,7 +1031,6 @@ distutils-r1_python_prepare_all() {
fi
python_export_utf8_locale
- [[ ${EAPI} == 6 ]] && xdg_environment_reset # Bug 577704
_distutils-r1_print_package_versions
_DISTUTILS_DEFAULT_CALLED=1
@@ -1516,7 +1496,7 @@ _distutils-r1_wrap_scripts() {
debug-print "${FUNCNAME}: installing wrapper at ${bindir}/${basename}"
local dosym=dosym
- [[ ${EAPI} == [67] ]] && dosym=dosym8
+ [[ ${EAPI} == 7 ]] && dosym=dosym8
"${dosym}" -r /usr/lib/python-exec/python-exec2 \
"${bindir#${EPREFIX}}/${basename}"
done
--
2.38.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-dev] [PATCH 3/5] python-any-r1.eclass: Stop allowing python2_7
2022-12-08 18:53 [gentoo-dev] [PATCH 0/5] distutils-r1 & python-utils-r1: cleanup old stuff Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 1/5] distutils-r1.eclass: Require meson-python >= 0.11.0 Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 2/5] distutils-r1.eclass: Remove EAPI 6 support Michał Górny
@ 2022-12-08 18:53 ` Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 4/5] python-utils-r1.eclass: Clean up post disabling python2_7 compat Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 5/5] python-utils-r1.eclass: Update python_optimize for PyPy3.9 Michał Górny
4 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2022-12-08 18:53 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/python-any-r1.eclass | 1 -
1 file changed, 1 deletion(-)
diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
index f1f54358000c..558f725f74b7 100644
--- a/eclass/python-any-r1.eclass
+++ b/eclass/python-any-r1.eclass
@@ -174,7 +174,6 @@ _python_any_set_globals() {
local usestr deps i PYTHON_PKG_DEP
[[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
- _PYTHON_ALLOW_PY27=1 \
_python_set_impls
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
--
2.38.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-dev] [PATCH 4/5] python-utils-r1.eclass: Clean up post disabling python2_7 compat
2022-12-08 18:53 [gentoo-dev] [PATCH 0/5] distutils-r1 & python-utils-r1: cleanup old stuff Michał Górny
` (2 preceding siblings ...)
2022-12-08 18:53 ` [gentoo-dev] [PATCH 3/5] python-any-r1.eclass: Stop allowing python2_7 Michał Górny
@ 2022-12-08 18:53 ` Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 5/5] python-utils-r1.eclass: Update python_optimize for PyPy3.9 Michał Górny
4 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2022-12-08 18:53 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/python-utils-r1.eclass | 65 ++++++++++-------------------------
1 file changed, 19 insertions(+), 46 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index c0099fa756ad..84c37cd29d60 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -133,9 +133,9 @@ _python_set_impls() {
# please keep them in sync with _PYTHON_ALL_IMPLS
# and _PYTHON_HISTORICAL_IMPLS
case ${i} in
- pypy3|python2_7|python3_[89]|python3_1[01])
+ pypy3|python3_[89]|python3_1[01])
;;
- jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7])
+ jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-7])
obsolete+=( "${i}" )
;;
*)
@@ -172,13 +172,7 @@ _python_set_impls() {
done
if [[ ! ${supp[@]} ]]; then
- # special-case python2_7 for python-any-r1
- if [[ ${_PYTHON_ALLOW_PY27} ]] && has python2_7 "${PYTHON_COMPAT[@]}"
- then
- supp+=( python2_7 )
- else
- die "No supported implementation in PYTHON_COMPAT."
- fi
+ die "No supported implementation in PYTHON_COMPAT."
fi
if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then
@@ -412,10 +406,6 @@ _python_export() {
local val
case "${impl}" in
- python2*|python3.6|python3.7*)
- # python* up to 3.7
- val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die
- ;;
python*)
# python3.8+
val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}-embed) || die
@@ -454,8 +444,6 @@ _python_export() {
PYTHON_PKG_DEP)
local d
case ${impl} in
- python2.7)
- PYTHON_PKG_DEP='>=dev-lang/python-2.7.10_p16:2.7';;
python3.8)
PYTHON_PKG_DEP=">=dev-lang/python-3.8.15_p3:3.8";;
python3.9)
@@ -466,8 +454,6 @@ _python_export() {
PYTHON_PKG_DEP=">=dev-lang/python-3.11.0_p2:3.11";;
python*)
PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
- pypy)
- PYTHON_PKG_DEP='>=dev-python/pypy-7.3.9-r2:0=';;
pypy3)
PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.9_p9:0=';;
*)
@@ -643,11 +629,7 @@ python_optimize() {
einfo "Optimize Python modules for ${instpath}"
case "${EPYTHON}" in
- python2.7|python3.[34])
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
- ;;
- python3.[5678]|pypy3)
+ python3.8|pypy3)
# both levels of optimization are separate since 3.5
"${PYTHON}" -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
"${PYTHON}" -O -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
@@ -656,9 +638,12 @@ python_optimize() {
python*)
"${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}"
;;
- *)
+ pypy)
"${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
;;
+ *)
+ die "${FUNCNAME}: unexpected EPYTHON=${EPYTHON}"
+ ;;
esac
done
}
@@ -955,15 +940,6 @@ _python_wrapper_setup() {
local EPYTHON PYTHON
_python_export "${impl}" EPYTHON PYTHON
- local pyver pyother
- if [[ ${EPYTHON} != python2* ]]; then
- pyver=3
- pyother=2
- else
- pyver=2
- pyother=3
- fi
-
# Python interpreter
# note: we don't use symlinks because python likes to do some
# symlink reading magic that breaks stuff
@@ -972,10 +948,10 @@ _python_wrapper_setup() {
#!/bin/sh
exec "${PYTHON}" "\${@}"
_EOF_
- cp "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die
- chmod +x "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die
+ cp "${workdir}/bin/python" "${workdir}/bin/python3" || die
+ chmod +x "${workdir}/bin/python" "${workdir}/bin/python3" || die
- local nonsupp=( "python${pyother}" "python${pyother}-config" )
+ local nonsupp=( python2 python2-config )
# CPython-specific
if [[ ${EPYTHON} == python* ]]; then
@@ -984,24 +960,22 @@ _python_wrapper_setup() {
exec "${PYTHON}-config" "\${@}"
_EOF_
cp "${workdir}/bin/python-config" \
- "${workdir}/bin/python${pyver}-config" || die
+ "${workdir}/bin/python3-config" || die
chmod +x "${workdir}/bin/python-config" \
- "${workdir}/bin/python${pyver}-config" || die
+ "${workdir}/bin/python3-config" || die
# Python 2.6+.
ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die
# Python 2.7+.
ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc \
- "${workdir}"/pkgconfig/python${pyver}.pc || die
+ "${workdir}"/pkgconfig/python3.pc || die
# Python 3.8+.
- if [[ ${EPYTHON} != python[23].[67] ]]; then
- ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \
- "${workdir}"/pkgconfig/python${pyver}-embed.pc || die
- fi
+ ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \
+ "${workdir}"/pkgconfig/python3-embed.pc || die
else
- nonsupp+=( 2to3 python-config "python${pyver}-config" )
+ nonsupp+=( 2to3 python-config python3-config )
fi
local x
@@ -1098,11 +1072,10 @@ python_fix_shebang() {
"${EPYTHON}")
match=1
;;
- python|python[23])
+ python|python3)
match=1
- [[ ${in_path##*/} == python2 ]] && error=1
;;
- python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9])
+ python2|python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9])
# Explicit mismatch.
match=1
error=1
--
2.38.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-dev] [PATCH 5/5] python-utils-r1.eclass: Update python_optimize for PyPy3.9
2022-12-08 18:53 [gentoo-dev] [PATCH 0/5] distutils-r1 & python-utils-r1: cleanup old stuff Michał Górny
` (3 preceding siblings ...)
2022-12-08 18:53 ` [gentoo-dev] [PATCH 4/5] python-utils-r1.eclass: Clean up post disabling python2_7 compat Michał Górny
@ 2022-12-08 18:53 ` Michał Górny
4 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2022-12-08 18:53 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/python-utils-r1.eclass | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 84c37cd29d60..df955371483e 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -629,13 +629,14 @@ python_optimize() {
einfo "Optimize Python modules for ${instpath}"
case "${EPYTHON}" in
- python3.8|pypy3)
+ python3.8)
# both levels of optimization are separate since 3.5
"${PYTHON}" -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
"${PYTHON}" -O -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
"${PYTHON}" -OO -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
;;
- python*)
+ python*|pypy3)
+ # Python 3.9+
"${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}"
;;
pypy)
--
2.38.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-12-08 18:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-08 18:53 [gentoo-dev] [PATCH 0/5] distutils-r1 & python-utils-r1: cleanup old stuff Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 1/5] distutils-r1.eclass: Require meson-python >= 0.11.0 Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 2/5] distutils-r1.eclass: Remove EAPI 6 support Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 3/5] python-any-r1.eclass: Stop allowing python2_7 Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 4/5] python-utils-r1.eclass: Clean up post disabling python2_7 compat Michał Górny
2022-12-08 18:53 ` [gentoo-dev] [PATCH 5/5] python-utils-r1.eclass: Update python_optimize for PyPy3.9 Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox