python: limit parallellism in compileall (#48441)

This commit is contained in:
AMD Toolchain Support 2025-02-25 18:24:59 +05:30 committed by GitHub
parent 93329d7f99
commit e28379e98b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -488,6 +488,11 @@ def patch(self):
r"^(.*)setup\.py(.*)((build)|(install))(.*)$", r"\1setup.py\2 --no-user-cfg \3\6" r"^(.*)setup\.py(.*)((build)|(install))(.*)$", r"\1setup.py\2 --no-user-cfg \3\6"
) )
# limit the number of processes to use for compileall in older Python versions
# https://github.com/python/cpython/commit/9a7e9f9921804f3f90151ca42703e612697dd430
if self.spec.satisfies("@:3.11"):
ff.filter("-j0 ", f"-j{make_jobs} ")
# disable building the nis module (there is no flag to disable it). # disable building the nis module (there is no flag to disable it).
if self.spec.satisfies("@3.8:3.10"): if self.spec.satisfies("@3.8:3.10"):
filter_file( filter_file(
@ -789,7 +794,7 @@ def install(self, spec, prefix):
self.win_installer(prefix) self.win_installer(prefix)
else: else:
# See https://github.com/python/cpython/issues/102007 # See https://github.com/python/cpython/issues/102007
make(*self.install_targets, parallel=False) make(*self.install_targets, f"COMPILEALL_OPTS=-j{make_jobs}", parallel=False)
@run_after("install") @run_after("install")
def filter_compilers(self): def filter_compilers(self):