• [gentoo-dev] [PATCH 00/30] One batch of Python eclass updates to rule t

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 13:50:01 2022
    Hi,

    Here's the largest batch of eclass updates in quite some time. They
    combine some new features needed for PEP 517 packages, other new
    features, refactoring, cleanup and cosmetic changes -- hopefully
    to stop the cache updates for some time.

    The changes can be also reviewed on GitHub, particularly if you want
    to see the big diff rather than the 30 individual changes: https://github.com/gentoo/gentoo/pull/24065

    The highlights are:

    1. A new distutils_pep517_install function is introduced that carries
    the "core" PEP 517 functionality (previously inline
    in distutils-r1_python_compile). This is mostly an internal change,
    except that it can be used to install additional packages required
    for tests (right now isort & pip need it). New isort revision
    is included.

    2. Some deprecated stuff that is no longer used in ::gentoo is removed.
    Since it causes failures in global scope, there's little risk
    of accidentally reintroducing its use.

    3. python-any-r1 + python-r1 any-of API is now much more verbose.
    It is explaining why a particular implementations is selected
    or rejected. In additional to that, a new python_has_version()
    wrapper is introduced that serves as a verbose alternative
    to has_version() for use in python_check_deps(). This particularly
    applies to USE=doc via distutils_enable_sphinx. (requested by soap)

    Screenshot: https://pbs.twimg.com/media/FK1wBkFXIAElWm7?format=jpg

    4. build_sphinx regression when Sphinx is not available for the current
    Python version is fixed. It was broken by PEP 517 changes.

    5. More complex inline Python invocations now use heredoc syntax
    instead of `-c` (thanks to arthurzam for the suggestion!). This
    improves readability a lot.

    6. python_optimize is also more verbose now.

    7. python_gen* now accept stdlib versions in additional to exact
    interpreter names. The primary use is replacing backport deps like:

    $(python_gen_cond_dep ... python3_7 pypy3)

    with more maintanable:

    $(python_gen_cond_dep ... 3.7)

    The big difference is that the latter doesn't need to be updated
    every time PyPy3 switches to a newer stdlib version.

    8. The eclasses now issue a QA warning if the ebuild has been updated
    recently (i.e. in 2022, through looking up the Copyright line)
    and PYTHON_COMPAT still lists old implementations. (requested
    by sam).

    9. Minimum tomli dep is raised to aid people who don't update their
    systems often enough.

    --
    Best regards,
    Michał Górny


    Michał Górny (30):
    distutils-r1.eclass: Split backend getting code into a function
    distutils-r1.eclass: Get wheel name from the backend
    distutils-r1.eclass: Create distutils_pep517_install helper
    dev-python/isort: Switch to PEP 517 build
    python-r1.eclass: Remove deprecated python_gen_usedep
    python-any-r1.eclass: Move EPYTHON validity check to python_setup()
    python-utils-r1.eclass: Add function to run python_check_deps()
    python-any-r1.eclass: Explain the reason for interpreter choice
    python-utils-r1.eclass: Report _python_run_check_deps verbosely
    python-utils-r1.eclass: Inline python_is_installed
    distutils-r1.eclass: Fix has_version for distutils_enable_sphinx
    python-utils-r1.eclass: Add a verbose python_has_version() wrapper
    distutils-r1.eclass: Use python_has_version in ...enable_sphinx
    python-utils-r1.eclass: Fix sphinx_build for non-autodoc case
    python-utils-r1.eclass: Remove deprecated python_export
    python-utils-r1.eclass: Remove python_wrapper_setup
    python-single-r1.eclass: Inline & simplify USE-deps in gen_cond_dep
    python-r1.eclass: Improve comment for USE-dep generation
    python-utils-r1.eclass: Remove python_is_python3
    python-single-r1.eclass: Remove PYTHON_MULTI_USEDEP
    distutils-r1.eclass: Use heredoc instead of "python -c"
    python-utils-r1.eclass: Use heredoc instead of "python -c"
    python-utils-r1.eclass: Remove old phase check from python_optimize
    python-utils-r1.eclass: Add status messages to python_optimize
    python-utils-r1.eclass: Support matching impls by stdlib version
    dev-python/jaraco-text: Use python_gen_cond_dep w/ stdlib ver
    python-any-r1.eclass: Do not test EPYTHON twice
    python-utils-r1.eclass: Add QA check for obsolete PYTHON_COMPAT
    dev-libs/libwacom: Use python_has_version for verbose output
    distutils-r1.eclass: Add min version to tomli dep

    dev-libs/libwacom/libwacom-1.11.ebuild | 6 +-
    dev-libs/libwacom/libwacom-1.12.ebuild | 6 +-
    dev-python/isort/isort-5.10.1-r1.ebuild | 65 +++++
    .../jaraco-text/jaraco-text-3.7.0-r1.ebuild | 2 +-
    eclass/distutils-r1.eclass | 215 ++++++++++-------
    eclass/python-any-r1.eclass | 62 ++---
    eclass/python-r1.eclass | 97 ++------
    eclass/python-single-r1.eclass | 68 +-----
    eclass/python-utils-r1.eclass | 227 +++++++++++-------
    eclass/tests/python-utils-r1.sh | 5 -
    10 files changed, 382 insertions(+), 371 deletions(-)
    create mode 100644 dev-python/isort/isort-5.10.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 Sun Feb 6 13:50:01 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 110 +++++++++++++++++++++----------------
    1 file changed, 63 insertions(+), 47 deletions(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 2b5acb09d926..81eea83c67b3 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -922,6 +922,68 @@ _distutils-r1_backend_to_key() {
    esac
    }

    +# @FUNCTION: _distutils-r1_get_backend
    +# @INTERNAL
    +# @DESCRIPTION:
    +# Read (or guess, in case of setuptools) the build-backend
    +# for the package in the current directory.
    +_distutils-r1_get_backend() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local build_backend
    + if [[ -f pyproject.toml ]]; then
    + # if pyproject.toml exists, try getting the backend from it
    + # NB: this could fail if pyproject.toml doesn't list one
    + build_backend=$("${EPYTHON}" -c 'import tomli; \
    + print(tomli.load(open("pyproject.toml", "rb")) \
    + ["build-system"]["build-backend"])' 2>/dev/null)
    + fi
    + if [[ -z ${build_backend} && ${D
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:02 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-r1.eclass | 12 +++++++++---
    1 file changed, 9 insertions(+), 3 deletions(-)

    diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
    index 469c3014abfb..bb851e167617 100644
    --- a/eclass/python-r1.eclass
    +++ b/eclass/python-r1.eclass
    @@ -393,9 +393,15 @@ python_gen_cond_dep() {
    _python_verify_patterns "${@}"
    for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
    if _python_impl_matches "${impl}" "${@}"; then
    - # substitute ${PYTHON_USEDEP} if used
    - # (since python_gen_usedep() will not return ${PYTHON_USEDEP}
    - # the code is run at most once)
    + # substitute ${PYTHON_USEDEP} with USE-dep on *all* matching
    + # targets, if it is used. this ensures that Portage will
    + # report all missing USE flags simultaneously rather than
    + # requesting the user to enable them one by one.
    + #
    + # NB: the first call with replace all instances
    + # of ${PYTHON_USEDEP}, so the condition will be false
    + # on subsequent loop iterations and _python_gen_usedep()
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:01 2022
    Add a python_has_version() wrapper that runs has_version in a verbose
    way that makes python_check_deps() failures easier to understand.

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

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 3d938f5ee74f..c3726437cb68 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -1380,5 +1380,21 @@ _python_run_check_deps() {
    eend ${?}
    }

    +# @FUNCTION: python_has_version
    +# @USAGE: [-b|-d|-r] <atom>
    +# @DESCRIPTION:
    +# A wrapper for has_version() with verbose output suitable for
    +# python_check_deps.
    +python_has_version() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local pkg=${1}
    + [[ ${pkg} == -* ]] && pkg=${2}
    +
    + ebegin " ${pkg}"
    + has_version "${@}"
    + eend ${?}
    +}
    +
    _PYTHON_UTILS_R1=1
    fi
    --
    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 Sun Feb 6 14:00:01 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-utils-r1.eclass | 41 ++++++++++++++++++++++++++++++-----
    1 file changed, 36 insertions(+), 5 deletions(-)

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index a42ae66d9c89..d423a28cccb5 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -316,13 +316,23 @@ _python_export() {
    ;;
    PYTHON_SITEDIR)
    [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
    - PYTHON_SITEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("purelib"))') || die
    + PYTHON_SITEDIR=$(
    + "${PYTHON}" - <<-EOF || die
    + import sysconfig
    + print(sysconfig.get_path("purelib"))
    + EOF
    + )
    export PYTHON_SITEDIR
    debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
    ;;
    PYTHON_INCLUDEDIR)
    [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
    - PYTHON_INCLUDEDIR=$("${PYTHON}"
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:02 2022
    Report dep checking progress verbosely, to help users understand why
    a particular implementations was rejected or selected.

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

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index f8c0c00ce919..2a83ef463ffd 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -1380,12 +1380,20 @@ _python_run_check_deps() {

    local impl=${1}

    - python_is_installed "${impl}" || return 1
    + einfo "Checking whether ${impl} is suitable ..."
    +
    + local PYTHON_PKG_DEP
    + _python_export "${impl}" PYTHON_PKG_DEP
    + ebegin " ${PYTHON_PKG_DEP}"
    + python_is_installed "${impl}"
    + eend ${?} || return 1
    declare -f python_check_deps >/dev/null || return 0

    local PYTHON_USEDEP="python_targets_${impl}(-)"
    local PYTHON_SINGLE_USEDEP="python_single_target_${impl}(-)"
    + ebegin " python_check_deps"
    python_check_deps
    + eend ${?}
    }

    _PYTHON_UTILS_R1=1
    --
    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 Sun Feb 6 14:00:03 2022
    Avoid checking the implementation from EPYTHON via fallback iteration.
    While there's no technical harm in doing that, now that we output
    verbosely the users will notice ;-).

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-any-r1.eclass | 14 ++++++++------
    1 file changed, 8 insertions(+), 6 deletions(-)

    diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
    index 5c01e9eb6888..4e954f57cd2d 100644
    --- a/eclass/python-any-r1.eclass
    +++ b/eclass/python-any-r1.eclass
    @@ -299,13 +299,13 @@ python_setup() {
    fi

    # first, try ${EPYTHON}... maybe it's good enough for us.
    - if [[ ${EPYTHON} ]]; then
    - local impl=${EPYTHON/./_}
    - if ! has "${impl}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then
    + local epython_impl=${EPYTHON/./_}
    + if [[ ${epython_impl} ]]; then
    + if ! has "${epython_impl}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then
    einfo "EPYTHON (${EPYTHON}) not supported by the package"
    - elif ! has "${impl}" "${_PYTHON_ALL_IMPLS[@]}"; then
    + elif ! has "${epython_impl}" "${_PYTHON_ALL_IMPLS[@]}"; then
    ewarn "Invalid EPYTHON: ${EPYTHON}"
    - elif _python_run_check_deps "${impl}"; then
    + elif _python_run_check_deps "${epython_impl}"; then
    _python_export EPYTHON PYTHON
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:03 2022
    Move the EPYTHON validity check from _python_EPYTHON_supported()
    to python_setup() where it belongs. This avoids unnecessarily retesting implementations taken from PYTHON_COMPAT and paves the way towards
    moving the common logic to python-utils-r1.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-any-r1.eclass | 36 ++++++++++++++----------------------
    1 file changed, 14 insertions(+), 22 deletions(-)

    diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
    index 282c449f2a03..4c832384ed7a 100644
    --- a/eclass/python-any-r1.eclass
    +++ b/eclass/python-any-r1.eclass
    @@ -283,28 +283,15 @@ _python_EPYTHON_supported() {
    local EPYTHON=${1}
    local i=${EPYTHON/./_}

    - case "${i}" in
    - python*|jython*|pypy*)
    - ;;
    - *)
    - ewarn "Invalid EPYTHON: ${EPYTHON}"
    - return 1
    - ;;
    - esac
    -
    - if has "${i}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then
    - if python_is_installed "${i}"; then
    - if declare -f python_check_deps >/dev/null; then
    - local PYTHON_USEDEP="python_targets_${i}(-)"
    - local PYTHON_SINGLE_USEDEP="python_single_target_${i}(-)"
    - python_check_deps
    - return ${?}
    - fi
    -
    - return 0
    + if python_is_installed "${i}"; then
    + if declare -f python_check_deps >/dev/null; then
    + local PYTHON_USEDEP="python_targets_${i}(-)"
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:04 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-python/jaraco-text/jaraco-text-3.7.0-r1.ebuild | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/dev-python/jaraco-text/jaraco-text-3.7.0-r1.ebuild b/dev-python/jaraco-text/jaraco-text-3.7.0-r1.ebuild
    index 66eb9f8d0462..0b6a909952eb 100644
    --- a/dev-python/jaraco-text/jaraco-text-3.7.0-r1.ebuild
    +++ b/dev-python/jaraco-text/jaraco-text-3.7.0-r1.ebuild
    @@ -23,7 +23,7 @@ RDEPEND="
    >=dev-python/jaraco-functools-3.5.0-r1[${PYTHON_USEDEP}]
    $(python_gen_cond_dep '
    >=dev-python/importlib_resources-5.4.0-r3[${PYTHON_USEDEP}]
    - ' python3_8 pypy3)
    + ' 3.8)
    "

    distutils_enable_sphinx docs \
    --
    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 Sun Feb 6 14:00:03 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-any-r1.eclass | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
    index 8d3af399b4be..5c01e9eb6888 100644
    --- a/eclass/python-any-r1.eclass
    +++ b/eclass/python-any-r1.eclass
    @@ -294,7 +294,7 @@ python_setup() {

    _python_export "${impls[0]}" EPYTHON PYTHON
    _python_wrapper_setup
    - einfo "Using ${EPYTHON} to build"
    + einfo "Using ${EPYTHON} to build (via PYTHON_COMPAT_OVERRIDE)"
    return
    fi

    @@ -308,7 +308,7 @@ python_setup() {
    elif _python_run_check_deps "${impl}"; then
    _python_export EPYTHON PYTHON
    _python_wrapper_setup
    - einfo "Using ${EPYTHON} to build"
    + einfo "Using ${EPYTHON} to build (via EPYTHON)"
    return
    fi
    fi
    @@ -320,7 +320,7 @@ python_setup() {
    _python_export "${impl}" EPYTHON PYTHON
    if _python_run_check_deps "${impl}"; then
    _python_wrapper_setup
    - einfo "Using ${EPYTHON} to build"
    + einfo "Using ${EPYTHON} to build (via PYTH
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:04 2022
    Add a function encompassing the common logic to run python_check_deps()
    from python-any-r1 and python-r1.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-any-r1.eclass | 32 ++++----------------------------
    eclass/python-r1.eclass | 7 +------
    eclass/python-utils-r1.eclass | 20 ++++++++++++++++++++
    3 files changed, 25 insertions(+), 34 deletions(-)

    diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
    index 4c832384ed7a..8d3af399b4be 100644
    --- a/eclass/python-any-r1.eclass
    +++ b/eclass/python-any-r1.eclass
    @@ -271,31 +271,6 @@ python_gen_any_dep() {
    echo "|| ( ${out})"
    }

    -# @FUNCTION: _python_EPYTHON_supported
    -# @USAGE: <epython>
    -# @INTERNAL
    -# @DESCRIPTION:
    -# Check whether the specified implementation is supported by package
    -# (specified in PYTHON_COMPAT). Calls python_check_deps() if declared. -_python_EPYTHON_supported() {
    - debug-print-function ${FUNCNAME} "${@}"
    -
    - local EPYTHON=${1}
    - local i=${EPYTHON/./_}
    -
    - if python_is_installed "${i}"; then
    - if declare -f python_check_deps >/dev/null; then
    - local PYTHON_USEDEP="python_targets_${i}(-)"
    - local PYTHON_SINGLE_
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:03 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 8 +++-----
    eclass/python-utils-r1.eclass | 17 -----------------
    eclass/tests/python-utils-r1.sh | 5 -----
    3 files changed, 3 insertions(+), 27 deletions(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 295263b62420..7f9cf242c421 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -333,11 +333,9 @@ unset -f _distutils_set_globals
    # (allowing any implementation). If multiple values are specified,
    # implementations matching any of the patterns will be accepted.
    #
    -# The patterns can be either fnmatch-style patterns (matched via bash
    -# == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate
    -# appropriately all enabled Python 2/3 implementations (alike
    -# python_is_python3). Remember to escape or quote the fnmatch patterns
    -# to prevent accidental shell filename expansion.
    +# The patterns are fnmatch-style patterns (matched via bash == operator
    +# against PYTHON_COMPAT values).
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:04 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-utils-r1.eclass | 9 ---------
    1 file changed, 9 deletions(-)

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index d423a28cccb5..7d6c81e14dc8 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -573,15 +573,6 @@ python_get_scriptdir() {
    python_optimize() {
    debug-print-function ${FUNCNAME} "${@}"

    - if [[ ${EBUILD_PHASE} == pre* || ${EBUILD_PHASE} == post* ]]; then
    - eerror "The new Python eclasses expect the compiled Python files to"
    - eerror "be controlled by the Package Manager. For this reason," - eerror "the python_optimize function can be used only during src_* phases"
    - eerror "(src_install most commonly) and not during pkg_* phases."
    - echo
    - die "python_optimize is not to be used in pre/post* phases"
    - fi
    -
    [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'

    local PYTHON=${PYTHON}
    --
    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 Sun Feb 6 14:00:04 2022
    Generate simpler USE-deps inline in python_gen_cond_dep() and remove _python_gen_usedep(). The original code always repeated USE deps
    on all targets to aid Portage in giving better suggestions. However,
    since there always will be exactly one implementation selected, this
    is unnecessary and we can just have every cond-dep match exactly that
    one target.

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

    diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass index 574ee9cfc04e..73afcdc3ed6c 100644
    --- a/eclass/python-single-r1.eclass
    +++ b/eclass/python-single-r1.eclass
    @@ -259,40 +259,6 @@ unset -f _python_single_set_globals

    if [[ ! ${_PYTHON_SINGLE_R1} ]]; then

    -# @FUNCTION: _python_gen_usedep
    -# @USAGE: [<pattern>...]
    -# @INTERNAL
    -# @DESCRIPTION:
    -# Output a USE dependency string for Python implementations which
    -# are both in PYTHON_COMPAT and match any of the patterns passed
    -# as parameters to the function.
    -#
    -# The patterns are fnmatch-style patterns (matched via bash
    -# == operator against PYTHON_COMPAT values). Remember to escape
    -# or quote the fnmatch patterns to prevent accidental shell filename
    -# expansion.
    -#
    -# This is an internal function used to implement python_gen_cond_dep. -_python_gen_usedep() {
    - debug-print
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:04 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-libs/libwacom/libwacom-1.11.ebuild | 6 +++---
    dev-libs/libwacom/libwacom-1.12.ebuild | 6 +++---
    2 files changed, 6 insertions(+), 6 deletions(-)

    diff --git a/dev-libs/libwacom/libwacom-1.11.ebuild b/dev-libs/libwacom/libwacom-1.11.ebuild
    index acfda32d8405..3e406d573b91 100644
    --- a/dev-libs/libwacom/libwacom-1.11.ebuild
    +++ b/dev-libs/libwacom/libwacom-1.11.ebuild
    @@ -35,9 +35,9 @@ BDEPEND="
    "

    python_check_deps() {
    - has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    + python_has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" && + python_has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    }

    pkg_setup() {
    diff --git a/dev-libs/libwacom/libwacom-1.12.ebuild b/dev-libs/libwacom/libwacom-1.12.ebuild
    index acfda32d8405..3e406d573b91 100644
    --- a/dev-libs/libwacom/libwacom
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:05 2022
    Inline the python_is_installed function that is used exactly once
    (in _python_run_check_deps). This helps us avoid having to grab
    PYTHON_PKG_DEP twice.

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

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 2a83ef463ffd..3d938f5ee74f 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -995,24 +995,6 @@ python_is_python3() {
    [[ ${impl} == python3* || ${impl} == pypy3 ]]
    }

    -# @FUNCTION: python_is_installed
    -# @USAGE: [<impl>]
    -# @DESCRIPTION:
    -# Check whether the interpreter for <impl> (or ${EPYTHON}) is installed.
    -# Uses has_version with a proper dependency string.
    -#
    -# Returns 0 (true) if it is, 1 (false) otherwise.
    -python_is_installed() {
    - local impl=${1:-${EPYTHON}}
    - [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
    - local hasv_args=( -b )
    - [[ ${EAPI} == 6 ]] && hasv_args=( --host-root )
    -
    - local PYTHON_PKG_DEP
    - _python_export "${impl}" PYTHON_PKG_DEP
    - has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
    -}
    -
    # @FUNCTION: python_fix_shebang
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:04 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-utils-r1.eclass | 16 ----------------
    1 file changed, 16 deletions(-)

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 99662c0a2e16..a2de1c2b506e 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -838,22 +838,6 @@ python_doheader() {
    )
    }

    -# @FUNCTION: python_wrapper_setup
    -# @USAGE: [<path> [<impl>]]
    -# @DESCRIPTION:
    -# Backwards compatibility function. The relevant API is now considered
    -# private, please use python_setup instead.
    -python_wrapper_setup() {
    - debug-print-function ${FUNCNAME} "${@}"
    -
    - eqawarn "python_wrapper_setup() is part of private eclass API."
    - eqawarn "Please call python_setup() instead."
    -
    - [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
    -
    - _python_wrapper_setup "${@}"
    -}
    -
    # @FUNCTION: _python_wrapper_setup
    # @USAGE: [<path> [<impl>]]
    # @INTERNAL
    --
    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 Sun Feb 6 14:00:05 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-python/isort/isort-5.10.1-r1.ebuild | 65 +++++++++++++++++++++++++
    1 file changed, 65 insertions(+)
    create mode 100644 dev-python/isort/isort-5.10.1-r1.ebuild

    diff --git a/dev-python/isort/isort-5.10.1-r1.ebuild b/dev-python/isort/isort-5.10.1-r1.ebuild
    new file mode 100644
    index 000000000000..11d6b04236b8
    --- /dev/null
    +++ b/dev-python/isort/isort-5.10.1-r1.ebuild
    @@ -0,0 +1,65 @@
    +# Copyright 1999-2022 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +EAPI=8
    +
    +DISTUTILS_USE_PEP517=poetry
    +PYTHON_COMPAT=( python3_{8..10} )
    +
    +inherit distutils-r1
    +
    +DESCRIPTION="A python utility/library to sort imports" +HOMEPAGE="https://pypi.org/project/isort/"
    +SRC_URI="
    + https://github.com/PyCQA/isort/archive/${PV}.tar.gz
    + -> ${P}.gh.tar.gz"
    +
    +LICENSE="MIT"
    +SLOT="0"
    +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
    +
    +RDEPEND="
    + dev-python/toml[${PYTHON_USEDEP}]"
    +BDEPEND="
    + test? (
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:06 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-single-r1.eclass | 7 -------
    1 file changed, 7 deletions(-)

    diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass index 73afcdc3ed6c..0e9a16a47d0e 100644
    --- a/eclass/python-single-r1.eclass
    +++ b/eclass/python-single-r1.eclass
    @@ -341,14 +341,7 @@ python_gen_cond_dep() {
    local single_usedep="python_single_target_${impl}(-)"
    local multi_usedep="python_targets_${impl}(-)"

    - if [[ ${EAPI} != [67] ]]; then
    - if [[ ${dep} == *\$\{PYTHON_MULTI_USEDEP\}* ]]; then
    - die "Replace PYTHON_MULTI_USEDEP with PYTHON_USEDEP in EAPI ${EAPI}"
    - fi
    - fi
    -
    local subdep=${dep//\$\{PYTHON_SINGLE_USEDEP\}/${single_usedep}}
    - subdep=${subdep//\$\{PYTHON_MULTI_USEDEP\}/${multi_usedep}}
    matches+=( "python_single_target_${impl}? (
    ${subdep//\$\{PYTHON_USEDEP\}/${multi_usedep}} )" )
    fi
    --
    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 Sun Feb 6 14:00:05 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index c0b04cf7d997..295263b62420 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -431,7 +431,7 @@ distutils_enable_sphinx() {
    [[ ${EAPI} == 6 ]] && hasv_args=( --host-root )
    local p
    for p in dev-python/sphinx "${_DISTUTILS_SPHINX_PLUGINS[@]}"; do
    - has_version "${hasv_args[@]}" "${p}[${PYTHON_USEDEP}]" ||
    + python_has_version "${hasv_args[@]}" "${p}[${PYTHON_USEDEP}]" ||
    return 1
    done
    }
    --
    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 Sun Feb 6 14:00:06 2022
    Closes: https://bugs.gentoo.org/832782
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 4feb9d7177ae..aa8496092cee 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -176,7 +176,7 @@ _distutils_set_globals() {
    # tomli is used to read build-backend from pyproject.toml
    bdep='
    >=dev-python/installer-0.4.0_p20220124[${PYTHON_USEDEP}]
    - dev-python/tomli[${PYTHON_USEDEP}]'
    + >=dev-python/tomli-1.2.3[${PYTHON_USEDEP}]'
    case ${DISTUTILS_USE_PEP517} in
    flit)
    bdep+='
    --
    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 Sun Feb 6 14:00:06 2022
    This function is deprecated for some time already and there are no more consumers left in ::gentoo.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-r1.eclass | 43 +----------------------------------------
    1 file changed, 1 insertion(+), 42 deletions(-)

    diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
    index 40ad4ef4bbf8..f9a9e9465b40 100644
    --- a/eclass/python-r1.eclass
    +++ b/eclass/python-r1.eclass
    @@ -294,8 +294,7 @@ _python_validate_useflags() {
    # or quote the fnmatch patterns to prevent accidental shell filename
    # expansion.
    #
    -# This is an internal function used to implement python_gen_cond_dep
    -# and deprecated python_gen_usedep.
    +# This is an internal function used to implement python_gen_cond_dep.
    _python_gen_usedep() {
    debug-print-function ${FUNCNAME} "${@}"

    @@ -316,46 +315,6 @@ _python_gen_usedep() {
    echo "${out// /,}"
    }

    -# @FUNCTION: python_gen_usedep
    -# @USAGE: <pattern> [...]
    -# @DESCRIPTION:
    -# DEPRECATED. Please use python_gen_cond_dep instead.
    -#
    -# Output a USE dependency string for Python implementations which
    -# are both in PYTHON_COMPAT and match any of the patt
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:06 2022
    Split the wheel build & install logic into a a new helper.

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

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 22070f6b74f4..814ee85a2b1f 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -984,6 +984,53 @@ _distutils-r1_get_backend() {
    echo "${build_backend}"
    }

    +# @FUNCTION: distutils_pep517_install
    +# @USAGE: [<root>]
    +# @DESCRIPTION:
    +# Build the wheel for the package in the current directory using PEP 517
    +# backend and install it into <root>. If <root> is not specified,
    +# ${BUILD_DIR}/install is used.
    +#
    +# This function is intended for expert use only. It does not handle
    +# wrapping executables.
    +distutils_pep517_install() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local root=${1:-${BUILD_DIR}/install}
    + local -x WHEEL_BUILD_DIR=${BUILD_DIR}/wheel
    + mkdir -p "${WHEEL_BUILD_DIR}" || die
    +
    + local build_backend=$(_distutils-r1_get_backend)
    + einfo "
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:07 2022
    Add a QA check that reports obsolete implementation in PYTHON_COMPAT
    if ebuild has been modified in 2022 (based on copyright year).
    Requested by sam.

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

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 291d7ce9b771..83ac0a68da45 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -123,6 +123,8 @@ _python_set_impls() {
    if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then
    die 'PYTHON_COMPAT must be an array.'
    fi
    +
    + local obsolete=()
    if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then
    for i in "${PYTHON_COMPAT[@]}"; do
    # check for incorrect implementations
    @@ -130,7 +132,10 @@ _python_set_impls() {
    # please keep them in sync with _PYTHON_ALL_IMPLS
    # and _PYTHON_HISTORICAL_IMPLS
    case ${i} in
    - jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9]|python3_10)
    + pypy3|python2_7|python3_[89]|python3_10)
    + ;;
    + jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7])
    + obsolete+=( "${i}" )
    ;;
    *)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:06 2022
    Update _python_impl_matches() (used to implement python_gen*,
    python_setup) to support specifying stdlib versions ("3.8", "3.9")
    in addition to exact implementation names. This makes handling PyPy3
    version changes much easier when dealing with backports.

    For example, if you specify "3.8", then the spec will match python3_8
    and pypy3, for as long as we supply PyPy3.8. Once we upgrade to PyPy3.9 completely, it will stop matching pypy3 and we won't have to manually
    keep updating these deps.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 5 ++---
    eclass/python-r1.eclass | 35 ++++++++++------------------------
    eclass/python-single-r1.eclass | 18 ++++++-----------
    eclass/python-utils-r1.eclass | 22 +++++++++++++++++----
    4 files changed, 36 insertions(+), 44 deletions(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index ea8fc7e5d165..4feb9d7177ae 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -333,9 +333,8 @@ unset -f _distutils_set_globals
    # (allowing any implementation). If multiple values are specified,
    # implementations matching any of the patterns will be accepted.
    #
    -# The patterns are fnmatch-style patterns (matched via bash == operator
    -# against PYTHON_COMPAT values). Remember to escape or quote the fnmatch
    -# patterns to prevent accidental shell filename expansion.
    +# For the pattern syntax, please see _python_impl_matches
    +# in python-utils-r1.eclass.
    #
    # If the restriction needs to apply conditionally to
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:07 2022
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-utils-r1.eclass | 1 +
    1 file changed, 1 insertion(+)

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 7d6c81e14dc8..1c6409add35c 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -610,6 +610,7 @@ python_optimize() {
    local instpath=${d#${D%/}}
    instpath=/${instpath##/}

    + einfo "Optimize Python modules for ${instpath}"
    case "${EPYTHON}" in
    python2.7|python3.[34])
    "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
    --
    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 Sun Feb 6 14:00:07 2022
    Use heredocs instead of inlining longish scripts in "python -c",
    for greater readability. Thanks to arthurzam for the suggestion.

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

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 7f9cf242c421..ea8fc7e5d165 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -936,9 +936,13 @@ _distutils-r1_get_backend() {
    if [[ -f pyproject.toml ]]; then
    # if pyproject.toml exists, try getting the backend from it
    # NB: this could fail if pyproject.toml doesn't list one
    - build_backend=$("${EPYTHON}" -c 'import tomli; \
    - print(tomli.load(open("pyproject.toml", "rb")) \
    - ["build-system"]["build-backend"])' 2>/dev/null)
    + build_backend=$(
    + "${EPYTHON}" - <<-EOF 2>/dev/null
    + import tomli
    + print(tomli.load(open("pyproject.toml", "rb")) + ["build-system"]["build-backend"])
    + EOF
    + )
    fi
    if [[ -z ${build_backend} && ${DISTUTILS_USE_PEP517} == setuptools &&
    -f setup.py ]]
    @@ -1004,10 +1008,13 @@ distutils_pep517_install() {
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Feb 6 14:00:07 2022
    Fix the has_version calls for distutils_enable_sphinx to use -b option (--host-root in earlier EAPIs).

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

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 814ee85a2b1f..c0b04cf7d997 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -426,9 +426,13 @@ distutils_enable_sphinx() {

    python_check_deps() {
    use doc || return 0
    +
    + local hasv_args=( -b )
    + [[ ${EAPI} == 6 ]] && hasv_args=( --host-root )
    local p
    for p in dev-python/sphinx "${_DISTUTILS_SPHINX_PLUGINS[@]}"; do
    - has_version "${p}[${PYTHON_USEDEP}]" || return 1
    + has_version "${hasv_args[@]}" "${p}[${PYTHON_USEDEP}]" ||
    + return 1
    done
    }
    else
    --
    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 Sun Feb 6 14:00:07 2022
    Remove python_export, as it is no longer used by any ebuilds
    in ::gentoo.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-utils-r1.eclass | 17 -----------------
    1 file changed, 17 deletions(-)

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 362e55aed06f..99662c0a2e16 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -266,23 +266,6 @@ _python_impl_matches() {
    # python2.7
    # @CODE

    -# @FUNCTION: python_export
    -# @USAGE: [<impl>] <variables>...
    -# @INTERNAL
    -# @DESCRIPTION:
    -# Backwards compatibility function. The relevant API is now considered
    -# private, please use python_get* instead.
    -python_export() {
    - debug-print-function ${FUNCNAME} "${@}"
    -
    - eqawarn "python_export() is part of private eclass API."
    - eqawarn "Please call python_get*() instead."
    -
    - [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
    -
    - _python_export "${@}"
    -}
    -
    # @FUNCTION: _python_export
    # @USAGE: [<impl>] <variables>...
    # @INTERNAL
    --
    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 Sun Feb 6 14:00:07 2022
    Fix the regression in calling sphinx-build for the non-autodoc case
    that causes the build to fail if dev-python/sphinx isn't built
    for the newest Python interpreter available. To account for this,
    we need to call sphinx-build as an executable (i.e. via python-exec).

    Ideally, build_sphinx would be aware of which case it is used for,
    and use appropriate invocation. Unfortunately, we cannot do that
    without breaking backwards compatibility. However, we can simply check
    if Sphinx is available via ${EPYTHON}, and fall back to calling
    python-exec directly. This is effectively equivalent to choosing
    the specific invocation directly, as python-exec would have respected
    the implementation specified by EPYTHON anyway if sphinx-build
    executable was available for it.

    Fixes: f6a17acb8b7c (...: Run sphinx-build via EPYTHON)
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-utils-r1.eclass | 22 ++++++++++++++++++----
    1 file changed, 18 insertions(+), 4 deletions(-)

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index c3726437cb68..362e55aed06f 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -1231,10 +1231,24 @@ build_sphinx() {

    sed -i -e 's:^intersphinx_mapping:disabled_&:' \
    "${dir}"/conf.py || die
    - # not all packages include the Makefile in pypi tarball
    - "${EPYTHON}" -m sphinx.cmd.build \
    - -b html -d "${dir}"/_build/doctrees "${dir}" \
    - "${dir}"/_build/html || die
    + # 1. not all packages include the Makefile in pypi tarball,
    + # so we call sphinx-build directly
    + # 2. if autodoc is used, we need to call sphinx via EPYTHON,
    + # to ensure that PEP 517 venv is respected
    + # 3. if autodoc is not used, then sphinx might not be installed
    + # for the current impl, so we need a fallback to sphinx-build
    + local command=( "${EPYTHON}" -m sphinx.cmd.build )
    + if ! "${EPYT
  • From Matt Turner@21:1/5 to mgorny@gentoo.org on Wed Feb 9 00:10:01 2022
    On Sun, Feb 6, 2022 at 4:57 AM Michał Górny <mgorny@gentoo.org> wrote:

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-libs/libwacom/libwacom-1.11.ebuild | 6 +++---
    dev-libs/libwacom/libwacom-1.12.ebuild | 6 +++---
    2 files changed, 6 insertions(+), 6 deletions(-)

    diff --git a/dev-libs/libwacom/libwacom-1.11.ebuild b/dev-libs/libwacom/libwacom-1.11.ebuild
    index acfda32d8405..3e406d573b91 100644
    --- a/dev-libs/libwacom/libwacom-1.11.ebuild
    +++ b/dev-libs/libwacom/libwacom-1.11.ebuild
    @@ -35,9 +35,9 @@ BDEPEND="
    "

    python_check_deps() {
    - has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    + python_has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    }

    pkg_setup() {
    diff --git a/dev-libs/libwacom/libwacom-1.12.ebuild b/dev-libs/libwacom/libwacom-1.12.ebuild
    index acfda32d8405..3e406d573b91 100644
    --- a/dev-libs/libwacom/libwacom-1.12.ebuild
    +++ b/dev-libs/libwacom/libwacom-1.12.ebuild
    @@ -35,9 +35,9 @@ BDEPEND="
    "

    python_check_deps() {
    - has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    + python_has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    }


    I like this, but just a question -- is this patch just an example of
    how we can transition other ebuilds, or are you planning a
    larger-scale replacement?

    Also, I've always felt a little uncomfortable with the
    python_check_deps() functions because of how easy it is to mess them
    up. E.g., app-emulation/spice/spice-0.15.0.ebuild contains:

    python_check_deps() {
    has_version -b ">=dev-python/pyparsing-1.5.6-r2[${PYTHON_USEDEP}]"
    has_version -b "dev-python/six[${PYTHON_USEDEP}]"
    }

    It should have a &&, right? There are many more instances of this in ::gentoo.

    I wonder if this wouldn't be a good opportunity to change the API a
    little. Could we make python_has_version take multiple arguments and
    return true iff all are satisfied? Maybe like this?

    python_check_deps() {
    has_version \
    -b ">=dev-python/pyparsing-1.5.6-r2[${PYTHON_USEDEP}]" \
    -b "dev-python/six[${PYTHON_USEDEP}]"
    }

    What do you think?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Matt Turner@21:1/5 to mattst88@gentoo.org on Wed Feb 9 00:20:01 2022
    On Tue, Feb 8, 2022 at 3:00 PM Matt Turner <mattst88@gentoo.org> wrote:

    On Sun, Feb 6, 2022 at 4:57 AM Michał Górny <mgorny@gentoo.org> wrote:

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-libs/libwacom/libwacom-1.11.ebuild | 6 +++---
    dev-libs/libwacom/libwacom-1.12.ebuild | 6 +++---
    2 files changed, 6 insertions(+), 6 deletions(-)

    diff --git a/dev-libs/libwacom/libwacom-1.11.ebuild b/dev-libs/libwacom/libwacom-1.11.ebuild
    index acfda32d8405..3e406d573b91 100644
    --- a/dev-libs/libwacom/libwacom-1.11.ebuild
    +++ b/dev-libs/libwacom/libwacom-1.11.ebuild
    @@ -35,9 +35,9 @@ BDEPEND="
    "

    python_check_deps() {
    - has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    + python_has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    }

    pkg_setup() {
    diff --git a/dev-libs/libwacom/libwacom-1.12.ebuild b/dev-libs/libwacom/libwacom-1.12.ebuild
    index acfda32d8405..3e406d573b91 100644
    --- a/dev-libs/libwacom/libwacom-1.12.ebuild
    +++ b/dev-libs/libwacom/libwacom-1.12.ebuild
    @@ -35,9 +35,9 @@ BDEPEND="
    "

    python_check_deps() {
    - has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    + python_has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    }


    I like this, but just a question -- is this patch just an example of
    how we can transition other ebuilds, or are you planning a
    larger-scale replacement?

    Also, I've always felt a little uncomfortable with the
    python_check_deps() functions because of how easy it is to mess them
    up. E.g., app-emulation/spice/spice-0.15.0.ebuild contains:

    python_check_deps() {
    has_version -b ">=dev-python/pyparsing-1.5.6-r2[${PYTHON_USEDEP}]"
    has_version -b "dev-python/six[${PYTHON_USEDEP}]"
    }

    It should have a &&, right? There are many more instances of this in ::gentoo.

    Hm, maybe it's less common than I thought. The only other instance I
    could find in a quick scan was dev-python/dbus-python/dbus-python-1.2.18.ebuild.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to Matt Turner on Wed Feb 9 01:00:01 2022
    On Tue, 2022-02-08 at 15:00 -0800, Matt Turner wrote:
    On Sun, Feb 6, 2022 at 4:57 AM Michał Górny <mgorny@gentoo.org> wrote:

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-libs/libwacom/libwacom-1.11.ebuild | 6 +++---
    dev-libs/libwacom/libwacom-1.12.ebuild | 6 +++---
    2 files changed, 6 insertions(+), 6 deletions(-)

    diff --git a/dev-libs/libwacom/libwacom-1.11.ebuild b/dev-libs/libwacom/libwacom-1.11.ebuild
    index acfda32d8405..3e406d573b91 100644
    --- a/dev-libs/libwacom/libwacom-1.11.ebuild
    +++ b/dev-libs/libwacom/libwacom-1.11.ebuild
    @@ -35,9 +35,9 @@ BDEPEND="
    "

    python_check_deps() {
    - has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    + python_has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    }

    pkg_setup() {
    diff --git a/dev-libs/libwacom/libwacom-1.12.ebuild b/dev-libs/libwacom/libwacom-1.12.ebuild
    index acfda32d8405..3e406d573b91 100644
    --- a/dev-libs/libwacom/libwacom-1.12.ebuild
    +++ b/dev-libs/libwacom/libwacom-1.12.ebuild
    @@ -35,9 +35,9 @@ BDEPEND="
    "

    python_check_deps() {
    - has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    - has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    + python_has_version -b "dev-python/python-libevdev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pyudev[${PYTHON_USEDEP}]" &&
    + python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
    }


    I like this, but just a question -- is this patch just an example of
    how we can transition other ebuilds, or are you planning a
    larger-scale replacement?

    I'm not planning to do this proactively, at least at this time. Though
    maybe it would be a good idea.


    Also, I've always felt a little uncomfortable with the
    python_check_deps() functions because of how easy it is to mess them
    up. E.g., app-emulation/spice/spice-0.15.0.ebuild contains:

    python_check_deps() {
    has_version -b ">=dev-python/pyparsing-1.5.6-r2[${PYTHON_USEDEP}]"
    has_version -b "dev-python/six[${PYTHON_USEDEP}]"
    }

    It should have a &&, right? There are many more instances of this in ::gentoo.

    Yes. Though I think the "more common" mistake is not using "-b" while
    it's the correct option most of the time.


    I wonder if this wouldn't be a good opportunity to change the API a
    little. Could we make python_has_version take multiple arguments and
    return true iff all are satisfied? Maybe like this?

    python_check_deps() {
    has_version \
    -b ">=dev-python/pyparsing-1.5.6-r2[${PYTHON_USEDEP}]" \
    -b "dev-python/six[${PYTHON_USEDEP}]"
    }

    What do you think?

    I suppose it could make sense, as well as defaulting to "-b". However,
    I need to think about it. Maybe I'll defer the addition of
    python_has_version to get the API cleared out and merge the rest
    ~tomorrow.

    --
    Best regards,
    Michał Górny

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam James@21:1/5 to mgorny@gentoo.org on Wed Feb 9 08:40:01 2022
    On Sun, 6 Feb 2022 13:48:11 +0100
    Michał Górny <mgorny@gentoo.org> wrote:

    Hi,

    Here's the largest batch of eclass updates in quite some time. They
    combine some new features needed for PEP 517 packages, other new
    features, refactoring, cleanup and cosmetic changes -- hopefully
    to stop the cache updates for some time.

    The changes can be also reviewed on GitHub, particularly if you want
    to see the big diff rather than the 30 individual changes: https://github.com/gentoo/gentoo/pull/24065


    lgtm, with the caveat of leaving out the has_version bits as per
    matt's comments for now, so we can flesh it out.

    While we're meddling with the eclassses, could we consider fixing
    the 'locale' calls on musl? musl guarantees a UTF 8 locale (I _think_
    C.UTF-8) but the current eclass logic leads to log spam as the command
    doesn't exist on musl systems.

    best,
    sam

    -----BEGIN PGP SIGNATURE-----

    iQGTBAEBCgB9FiEEYOpPv/uDUzOcqtTy9JIoEO6gSDsFAmIDbnFfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDYw RUE0RkJGRkI4MzUzMzM5Q0FBRDRGMkY0OTIyODEwRUVBMDQ4M0IACgkQ9JIoEO6g SDueUggAqa4Xo93BhVUSlYxSau+8iuWR8BMMzVjDVOdmlEgkk6w76UfJDOsXZOBf FWMA7/TurmB4miy83dyGHUjyUVZMW93bjigohcHFWUClhVa8e9tTZcnLGO9NLALz 2uGpHqGFhWKwyj6uNSNBwZvzP5C06oZL8F2nIRn2+Tj9djJVIt7zEDXfMByWzGZA TJ60ScR8z/4sAIJlpZGZG1q3MRAynuj2E9hZOdbVXdDKpbmsyKnlUked5JLoU4LJ f9H9UYqZ3BgoVHKwzBYJnbTOWWYIwrmKoo5NEyM2sN3PFSrEJ4CfQuEPf62WZI7K gmbiDrTTQ9lxv7IbQ2ZiilaR93nwuA==
    =UiQM
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Joshua Kinard@21:1/5 to Sam James on Wed Feb 9 10:30:02 2022
    On 2/9/2022 02:34, Sam James wrote:
    [snip]

    While we're meddling with the eclassses, could we consider fixing
    the 'locale' calls on musl? musl guarantees a UTF 8 locale (I _think_ C.UTF-8) but the current eclass logic leads to log spam as the command doesn't exist on musl systems.

    best,
    sam

    Someone might want to look at packaging this utility then: https://gitlab.com/rilian-la-te/musl-locales

    I briefly toyed with it while trying to understand the
    lxml/ISO-8859-15/repoman bug (still need to go upstream; on TODO list), and
    it does execute on musl once compiled and lists the locale as C.UTF-8. But
    I couldn't find any actual locale files to see if it can reliably switch between them. I read somewhere that one could borrow the locale files from glibc, but no set instructions on how to actually go about doing that.

    That said, its existence in a musl stage would solve the problem highlighted
    by tools blindly trying to call 'locale' and logging that it doesn't exist.

    --
    Joshua Kinard
    Gentoo/MIPS
    kumba@gentoo.org
    rsa6144/5C63F4E3F5C6C943 2015-04-27
    177C 1972 1FB8 F254 BAD0 3E72 5C63 F4E3 F5C6 C943

    "The past tempts us, the present confuses us, the future frightens us. And
    our lives slip away, moment by moment, lost in that vast, terrible in-between."

    --Emperor Turhan, Centauri Republic

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to Sam James on Wed Feb 9 10:40:01 2022
    On Wed, 2022-02-09 at 07:34 +0000, Sam James wrote:
    While we're meddling with the eclassses, could we consider fixing
    the 'locale' calls on musl? musl guarantees a UTF 8 locale (I _think_ C.UTF-8) but the current eclass logic leads to log spam as the command doesn't exist on musl systems.

    Well, this seems like a rather trivial fix, so I've just added it on top
    of the existing batch.

    --
    Best regards,
    Michał Górny

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