From 9a1d12039d21106781fddbd0fdf1981e09f563b9 Mon Sep 17 00:00:00 2001 From: Laszlo Valko Date: Mon, 14 Jun 2021 21:08:50 +0200 Subject: [PATCH] Fixed handling Python 2.7. --- eclass/xdistutils-r1.eclass | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/eclass/xdistutils-r1.eclass b/eclass/xdistutils-r1.eclass index 86df168..26aec7c 100644 --- a/eclass/xdistutils-r1.eclass +++ b/eclass/xdistutils-r1.eclass @@ -5,3 +5,36 @@ else fi inherit distutils-r1 + +# @FUNCTION: distutils-r1_python_compile +# @USAGE: [additional-args...] +# @DESCRIPTION: +# The default python_compile(). Runs 'esetup.py build'. Any parameters +# passed to this function will be appended to setup.py invocation, +# i.e. passed as options to the 'build' command. +# +# This phase also sets up initial setup.cfg with build directories +# and copies upstream egg-info files if supplied. +distutils-r1_python_compile() { + debug-print-function ${FUNCNAME} "${@}" + + _distutils-r1_copy_egg_info + + local build_args=() + # distutils is parallel-capable since py3.5 + # to avoid breaking stable ebuilds, enable it only if either: + # a. we're dealing with EAPI 7 + # b. we're dealing with Python 3.7 or PyPy3 + if python_is_python3 && [[ ${EPYTHON} != python3.4 ]]; then + if [[ ${EAPI} != [56] || ${EPYTHON} != python3.[56] ]]; then + local jobs=$(makeopts_jobs "${MAKEOPTS}" INF) + if [[ ${jobs} == INF ]]; then + local nproc=$(get_nproc) + jobs=$(( nproc + 1 )) + fi + build_args+=( -j "${jobs}" ) + fi + fi + + esetup.py build "${build_args[@]}" "${@}" +}