• [gentoo-dev] [PATCH 0/7] distutils-r1.eclass: DISTUTILS_USE_PEP517=no,

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

    Unfortunately, the previous version of the patchset has caused
    regressions, so I had to revert the few last commits. Here's a little different approach that should be safe for existing ebuilds,
    and possibly less confusing to ebuild authors.

    Moving the ${BUILD_DIR}/install to D merge logic from distutils-r1_python_install into post-python_install broke ebuilds that
    relied on modifying the install tree in python_install. The new version
    leaves it in distutils-r1_python_install, so that existing ebuilds
    continue working.

    The different for 'no' mode is that distutils-r1_python_install needs
    to be called if you override python_install and expect the merging
    to happen.


    Michał Górny (7):
    distutils-r1.eclass: Move venv creation to post-compile
    distutils-r1.eclass: Future-proof python_install() for empty root
    distutils-r1.eclass: Move python_optimize call to post-install
    distutils-r1.eclass: Introduce DISTUTILS_USE_PEP517=no mode
    dev-python/tomli: Use DISTUTILS_USE_PEP517=no
    dev-python/installer: Use DISTUTILS_USE_PEP517=no
    dev-python/gpep517: Use DISTUTILS_USE_PEP517=no

    dev-python/gpep517/gpep517-6-r1.ebuild | 41 ++++++
    .../installer/installer-0.5.1-r1.ebuild | 37 +++++
    dev-python/tomli/tomli-2.0.1-r1.ebuild | 36 +++++
    eclass/distutils-r1.eclass | 135 ++++++++++++------
    4 files changed, 206 insertions(+), 43 deletions(-)
    create mode 100644 dev-python/gpep517/gpep517-6-r1.ebuild
    create mode 100644 dev-python/installer/installer-0.5.1-r1.ebuild
    create mode 100644 dev-python/tomli/tomli-2.0.1-r1.ebuild

    --
    2.35.1

    --- 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 7 22:10:01 2022
    ---
    eclass/distutils-r1.eclass | 65 ++++++++++++++++++++++----------------
    1 file changed, 38 insertions(+), 27 deletions(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 7829e521ca7b..e5e11c75e39f 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -1370,33 +1370,7 @@ distutils-r1_python_compile() {
    addpredict /usr/lib/portage/pym
    addpredict /usr/local # bug 498232

    - local root=${BUILD_DIR}/install
    - distutils_pep517_install "${root}"
    -
    - # copy executables to python-exec directory
    - # we do it early so that we can alter bindir recklessly
    - local bindir=${root}${EPREFIX}/usr/bin
    - local rscriptdir=${root}$(python_get_scriptdir)
    - [[ -d ${rscriptdir} ]] &&
    - die "${rscriptdir} should not exist!"
    - if [[ -d ${bindir} ]]; then
    - mkdir -p "${rscriptdir}" || die
    - cp -a --reflink=auto "${bindir}"/. "${rscriptdir}"/ || die
    - fi
    -
    - # enable venv magic inside the install tree
    - mkdir -p "${bindir}" || die
    -
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jun 7 22:20:01 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-python/gpep517/gpep517-6-r1.ebuild | 41 ++++++++++++++++++++++++++
    1 file changed, 41 insertions(+)
    create mode 100644 dev-python/gpep517/gpep517-6-r1.ebuild

    diff --git a/dev-python/gpep517/gpep517-6-r1.ebuild b/dev-python/gpep517/gpep517-6-r1.ebuild
    new file mode 100644
    index 000000000000..ee64cb1d660f
    --- /dev/null
    +++ b/dev-python/gpep517/gpep517-6-r1.ebuild
    @@ -0,0 +1,41 @@
    +# Copyright 2022 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# please keep this ebuild at EAPI 7 -- sys-apps/portage dep
    +EAPI=7
    +
    +DISTUTILS_USE_PEP517=no
    +PYTHON_COMPAT=( pypy3 python3_{8..11} )
    +
    +inherit distutils-r1
    +
    +DESCRIPTION="A backend script to aid installing Python packages in Gentoo" +HOMEPAGE="
    + https://pypi.org/project/gpep517/
    + https://github.com/mgorny/gpep517/
    +"
    +SRC_URI="
    + https://github.com/mgorny/gpep517/archive/v${PV}.tar.gz
    + -> ${P}.gh.tar.gz
    +"
    +
    +LICENSE="MIT"
    +SLOT="0"
    +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia6
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jun 7 22:20:01 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    .../installer/installer-0.5.1-r1.ebuild | 37 +++++++++++++++++++
    1 file changed, 37 insertions(+)
    create mode 100644 dev-python/installer/installer-0.5.1-r1.ebuild

    diff --git a/dev-python/installer/installer-0.5.1-r1.ebuild b/dev-python/installer/installer-0.5.1-r1.ebuild
    new file mode 100644
    index 000000000000..4f89e7433018
    --- /dev/null
    +++ b/dev-python/installer/installer-0.5.1-r1.ebuild
    @@ -0,0 +1,37 @@
    +# Copyright 2022 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# please keep this ebuild at EAPI 7 -- sys-apps/portage dep
    +EAPI=7
    +
    +DISTUTILS_USE_PEP517=no
    +PYTHON_COMPAT=( python3_{8..11} pypy3 )
    +
    +inherit distutils-r1
    +
    +DESCRIPTION="A library for installing Python wheels"
    +HOMEPAGE="
    + https://pypi.org/project/installer/
    + https://github.com/pypa/installer/
    + https://installer.readthedocs.io/en/latest/
    +"
    +SRC_URI="
    + https://github.com/pypa/installer/archive/${PV}.tar.gz
    + -> ${P}.gh.tar.gz
    + https://files.pythonh
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jun 7 22:20:01 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 32 ++++++++++++++++++--------------
    1 file changed, 18 insertions(+), 14 deletions(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 370b8bb7c6e0..9293f744c7c2 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -1558,11 +1558,6 @@ distutils-r1_python_install() {

    if [[ ${merge_root} ]]; then
    multibuild_merge_root "${root}" "${D%/}"
    - if [[ ${DISTUTILS_USE_PEP517} ]]; then
    - # we need to recompile everything here in order to embed
    - # the correct paths
    - python_optimize "${D%/}$(python_get_sitedir)"
    - fi
    fi
    if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
    _distutils-r1_wrap_scripts "${scriptdir}"
    @@ -1858,16 +1853,25 @@ distutils-r1_src_test() {
    _distutils-r1_post_python_install() {
    debug-print-function ${FUNCNAME} "${@}"

    - local forbidden_package_names=(
    - examples test tests
    - .pytest_cache .hypothesis _trial_temp
    - )
    - local p
    - for p in "${forbidden_package_names[@]}"; do
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jun 7 22:20:01 2022
    Introduce a new DISTUTILS_USE_PEP517 value "no" that stands for
    "no build system". This is primarily meant to replace the legacy
    distutils-r1 logic used for bootstrapping baseline PEP 517 packages.
    At the same time, it provides a convenient replacement for some
    of the uses of python-r1.

    In this mode, the eclass does not add PEP 517-specific dependencies
    and the default python_compile() is a no-op. However, it does set dependencies, REQUIRED_USE and enables sub-phase usage (with respect to DISTUTILS_OPTIONAL). It also permits using
    distutils_enable_{sphinx,tests}.

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

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 9293f744c7c2..f3d224a51224 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -106,6 +106,8 @@ esac
    #
    # - maturin - maturin backend
    #
    +# - no - no PEP517 build system (see below)
    +#
    # - pbr - pbr backend
    #
    # - pdm - pdm.pep517 backend
    @@ -121,6 +123,17 @@ esac
    #
    # The variable needs to be set before the inherit line. The eclass
    # adds appropriate build-time dependencies and verifies the value.
    +#
    +# The special value "no" indicates that the package has no build system.
    +# This is not equivalent to unset DISTUTILS_USE_PEP517 (legacy mode).
    +# It causes the eclass not to include any build system dependencies
    +# and to disable default python_compile() and python_install()
    +# implementations. Baseline Python deps and phase functions will still
    +# be set (dependin
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jun 7 22:20:01 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-python/tomli/tomli-2.0.1-r1.ebuild | 36 ++++++++++++++++++++++++++
    1 file changed, 36 insertions(+)
    create mode 100644 dev-python/tomli/tomli-2.0.1-r1.ebuild

    diff --git a/dev-python/tomli/tomli-2.0.1-r1.ebuild b/dev-python/tomli/tomli-2.0.1-r1.ebuild
    new file mode 100644
    index 000000000000..338d877a350d
    --- /dev/null
    +++ b/dev-python/tomli/tomli-2.0.1-r1.ebuild
    @@ -0,0 +1,36 @@
    +# Copyright 2021-2022 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# please keep this ebuild at EAPI 7 -- sys-apps/portage dep
    +EAPI=7
    +
    +DISTUTILS_USE_PEP517=no
    +PYTHON_COMPAT=( python3_{8..11} pypy3 )
    +
    +inherit distutils-r1
    +
    +DESCRIPTION="A lil' TOML parser"
    +HOMEPAGE="
    + https://pypi.org/project/tomli/
    + https://github.com/hukkin/tomli/
    +"
    +SRC_URI="
    + https://github.com/hukkin/tomli/archive/${PV}.tar.gz
    + -> ${P}.gh.tar.gz
    + https://files.pythonhosted.org/packages/py3/${PN::1}/${PN}/${P}-py3-none-any.whl
    + -> ${P}-py3-none-any.whl.zip
    +"
    +
    +