• [gentoo-dev] [PATCH 5/7] distutils-r1.eclass: Refactor `distutils_enabl

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Mar 26 19:30:02 2024
    Refactor `distutils_enable_tests pytest` to move `test_pkgs` logic
    straight into pytest block, as it is not used by any other variant
    anymore.

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

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 44553f8da6f3..a1617999a037 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -606,16 +606,23 @@ distutils_enable_tests() {
    [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes exactly one argument: test-runner"

    local test_deps=${RDEPEND}
    - local test_pkgs
    case ${1} in
    pytest)
    - test_pkgs='>=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]' + local test_pkgs='>=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]'
    if [[ -n ${EPYTEST_TIMEOUT} ]]; then
    test_pkgs+=' dev-python/pytest-timeout[${PYTHON_USEDEP}]'
    fi
    if [[ ${EPYTEST_XDIST} ]]; then
    test_pkgs+=' dev-python/pytest-xdist[${PYTHON_USEDEP}]'
    fi
    +
    + if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
    + test_deps+=" ${test_pkgs//'${PYTHON_USEDEP}'/${PYTHON_USEDEP}}"
    + else
    + test_deps+=" $(python_gen_cond_dep "