• [gentoo-dev] [PATCH 1/3] distutils-r1.eclass: Run build_ext only if the

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Fri Apr 22 10:00:01 2022
    Run parallel build_ext only if there are at least two potential source
    files to compile. This call is expensive and parallel builds do not
    benefit us if there is only one file to compile.

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

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 5528ff74cccf..d213cca4bb72 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -1189,14 +1189,18 @@ distutils-r1_python_compile() {
    fi

    if [[ ${DISTUTILS_USE_PEP517} && ${GPEP517_TESTING} ]]; then
    - # issue build_ext only if it looks like we have something
    - # to build; setuptools is expensive to start
    + # issue build_ext only if it looks like we have at least
    + # two source files to build; setuptools is expensive
    + # to start and parallel builds can only benefit us if we're
    + # compiling at least two files
    + #
    # see extension.py for list of suffixes
    # .pyx is added for Cython
    - if [[ -n $(
    + if [[ 2 -eq $(
    find '(' -name '*.c' -o -name '*.cc' -o -name '*.cpp' \
    -o -name '*.cxx' -o -name '*.c++' -o -name '*.m' \
    - -o -name '*.mm' -o -name '*.p
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Fri Apr 22 10:00:01 2022
    Account for distutils-r1_python_compile arguments when counting
    makejobs. This is needed to correctly detect forced "-j1",
    e.g. in dev-python/pandas.

    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 c314c52a78cd..4b376d6a1cc5 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -1182,7 +1182,7 @@ distutils-r1_python_compile() {
    fi

    # distutils is parallel-capable since py3.5
    - local jobs=$(makeopts_jobs "${MAKEOPTS}" INF)
    + local jobs=$(makeopts_jobs "${MAKEOPTS} ${*}" INF)
    if [[ ${jobs} == INF ]]; then
    local nproc=$(get_nproc)
    jobs=$(( nproc + 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 Fri Apr 22 10:00:01 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 d213cca4bb72..c314c52a78cd 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -1196,7 +1196,7 @@ distutils-r1_python_compile() {
    #
    # see extension.py for list of suffixes
    # .pyx is added for Cython
    - if [[ 2 -eq $(
    + if [[ 1 -ne ${jobs} && 2 -eq $(
    find '(' -name '*.c' -o -name '*.cc' -o -name '*.cpp' \
    -o -name '*.cxx' -o -name '*.c++' -o -name '*.m' \
    -o -name '*.mm' -o -name '*.pyx' ')' -printf '\n' |
    --
    2.35.1

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