• [gentoo-dev] [PATCH 0/8] python-r1 + distutils-r1: PYTHON_USEDEP in pha

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jun 11 18:10:01 2024
    Hi,

    Here's a next batch of minor changes to distutils-r1 + a signifcant
    change to python-r1.

    For python-r1, the patch overrides PYTHON_USEDEP
    and PYTHON_SINGLE_USEDEP for phase function calls, similarly to how we
    do it for python_check_deps(). This makes it possible to easily perform has_version calls for the dependencies of a package, e.g. to
    conditionally skip some tests.

    In fact, I was so used to python_check_deps() doing that, that I've
    forgotten that distutils-r1 doesn't do it and relied on it in a bunch
    of ebuilds (effectively deselecting tests on all implementations when
    I only meant to do it on a few).

    As for distutils-r1, the biggest change is removing distutils_install_for_testing (and distutils_enable_tests --install).
    It was deprecated for a while now along with legacy builds, and it is
    only used in ::gentoo in old package versions (that will be removed
    along with the change). This is a step towards pushing overlays
    to PEP517 migration.

    Besides that, some eclass documentation improvements are included,
    and DISTUTILS_IN_SOURCE_BUILD is marked as deprecated via eclassdoc, effectively triggering pkgcheck reports about it. That will probably
    be the next legacy build feature to be removed.

    Pull request: https://github.com/gentoo/gentoo/pull/36945


    Michał Górny (8):
    distutils-r1.eclass: Remove doc for DOCS, HTML_DOCS and PATCHES
    distutils-r1.eclass: Doc DISTUTILS_OPTIONAL + DISTUTILS_SINGLE_IMPL
    distutils-r1.eclass: Doc DISTUTILS_IN_SOURCE_BUILD as deprecated
    distutils-r1.eclass: Document BUILD_DIR for consistency
    distutils-r1.eclass: Remove support for `d_e_t --install`
    distutils-r1.eclass: Remove distutils_install_for_testing
    distutils-r1.eclass: Change "PEP 517" to "PEP517", for consistency
    python-r1.eclass: Override PYTHON*_USEDEP in sub-phases

    eclass/distutils-r1.eclass | 217 ++++++-------------------------------
    eclass/python-r1.eclass | 4 +-
    2 files changed, 38 insertions(+), 183 deletions(-)

    --
    2.45.2

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jun 11 18:10:01 2024
    Closes: https://bugs.gentoo.org/780807
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 5 +++++
    1 file changed, 5 insertions(+)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index eac4d592efaf..392725d48121 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -78,6 +78,11 @@ esac
    # for your package (using ${PYTHON_DEPS}) and to either call
    # distutils-r1 default phase functions or call the build system
    # manually.
    +#
    +# Note that if DISTUTILS_SINGLE_IMPL is used, python-single-r1 exports
    +# pkg_setup() function. In that case, it is necessary to redefine
    +# pkg_setup() to call python-single-r1_pkg_setup over correct
    +# conditions.

    # @ECLASS_VARIABLE: DISTUTILS_SINGLE_IMPL
    # @DEFAULT_UNSET
    --
    2.45.2

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jun 11 18:10:01 2024
    Remove the redundant (and outdated) documentation for the DOCS,
    HTML_DOCS and PATCHES variables. All these variables are handled
    through the default EAPI functions.

    Closes: https://bugs.gentoo.org/932802
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 46 --------------------------------------
    1 file changed, 46 deletions(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 71b80fafe1a5..eac4d592efaf 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -364,52 +364,6 @@ _distutils_set_globals() {
    _distutils_set_globals
    unset -f _distutils_set_globals

    -# @ECLASS_VARIABLE: PATCHES
    -# @DEFAULT_UNSET
    -# @DESCRIPTION:
    -# An array containing patches to be applied to the sources before
    -# copying them.
    -#
    -# If unset, no custom patches will be applied.
    -#
    -# Please note, however, that at some point the eclass may apply
    -# additional distutils patches/quirks independently of this variable.
    -#
    -# Example:
    -# @CODE
    -# PATCHES=( "${FILESDIR}"/${P}-make-gentoo-happy.patch )
    -# @CODE
    -
    -# @ECLASS_VARIABLE: DOCS
    -# @DEFAULT_UNSET
    -# @DESCRIPTION:
    -# An array containing documents installed using dodoc. The files listed
    -# there must exist in the directory
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jun 11 18:20:01 2024
    Closes: https://bugs.gentoo.org/910661
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 16 ++++++++++++++++
    1 file changed, 16 insertions(+)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 2b610a4d2ceb..3d72a5d3d554 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -206,6 +206,22 @@ esac
    # the build system in pure Python packages and packages using the stable
    # Python ABI.

    +# @ECLASS_VARIABLE: BUILD_DIR
    +# @OUTPUT_VARIABLE
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# The current build directory. In global scope, it is supposed to
    +# contain an initial build directory; if unset, it defaults to ${S}.
    +#
    +# When running in multi-impl mode, the BUILD_DIR variable is set
    +# by python-r1.eclass. Otherwise, it is set by distutils-r1.eclass
    +# for consistency.
    +#
    +# Example value:
    +# @CODE
    +# ${WORKDIR}/foo-1.3-python3_12
    +# @CODE
    +
    if [[ -z ${_DISTUTILS_R1_ECLASS} ]]; then
    _DISTUTILS_R1_ECLASS=1

    --
    2.45.2

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jun 11 18:20:01 2024
    Remove `distutils_install_for_testing` function. It is quite complex,
    and it was used only in the legacy eclass mode. All ebuilds using it
    in ::gentoo have been migrated to PEP517 build already, and the PEP517
    build implement the same functionality better.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 123 ++-----------------------------------
    1 file changed, 5 insertions(+), 118 deletions(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index f0d9d3a4b937..afed1fa547d1 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -704,123 +704,12 @@ esetup.py() {
    }

    # @FUNCTION: distutils_install_for_testing
    -# @USAGE: [--via-root|--via-home|--via-venv] [<args>...]
    +# @DEPRECATED: DISTUTILS_USE_PEP517=...
    # @DESCRIPTION:
    -# Install the package into a temporary location for running tests.
    -# Update PYTHONPATH appropriately and set TEST_DIR to the test
    -# installation root. The Python packages will be installed in 'lib'
    -# subdir, and scripts in 'scripts' subdir (like in BUILD_DIR).
    -#
    -# Please note that this function should be only used if package uses
    -# namespaces (and therefore proper install needs to be done to enforce
    -# PYTHONPATH) or tests rely on the results of install command.
    -# For most of the pack
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jun 11 18:20:01 2024
    Override the value of PYTHON_USEDEP and PYTHON_SINGLE_USEDEP to match
    the current implementation inside sub-phase function. This makes
    it possible to use them in has_version checks with conditional
    dependencies.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-r1.eclass | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
    index fbc6082a1d92..c5fa6770558f 100644
    --- a/eclass/python-r1.eclass
    +++ b/eclass/python-r1.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 1999-2023 Gentoo Authors
    +# Copyright 1999-2024 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: python-r1.eclass
    @@ -594,6 +594,8 @@ _python_multibuild_wrapper() {

    local -x EPYTHON PYTHON
    local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
    + local PYTHON_USEDEP="python_targets_${MULTIBUILD_VARIANT}(-)"
    + local PYTHON_SINGLE_USEDEP="python_single_target_${MULTIBUILD_VARIANT}(-)"
    _python_export "${MULTIBUILD_VARIANT}" EPYTHON PYTHON
    _python_wrapper_setup

    --
    2.45.2

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)