From a073237caf5a711d146dca7ebb16c14630fc4579 Mon Sep 17 00:00:00 2001 From: avkarenow Date: Thu, 15 Aug 2024 18:39:16 +0200 Subject: [PATCH] Use len(os.sched_getaffinity(0)) instead of os.cpu_count() (#591) Co-authored-by: Fantix King --- .github/workflows/tests.yml | 1 + setup.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4f48a1e0..c35d13c9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,6 +13,7 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: python-version: - "3.8" diff --git a/setup.py b/setup.py index ba15af50..c369ac80 100644 --- a/setup.py +++ b/setup.py @@ -176,7 +176,11 @@ def build_libuv(self): cmd, cwd=LIBUV_BUILD_DIR, env=env, check=True) - j_flag = '-j{}'.format(os.cpu_count() or 1) + try: + njobs = len(os.sched_getaffinity(0)) + except AttributeError: + njobs = os.cpu_count() + j_flag = '-j{}'.format(njobs or 1) c_flag = "CFLAGS={}".format(env['CFLAGS']) subprocess.run( ['make', j_flag, c_flag],