From c8531c2431a45beeb3c86ec04dcd9a778dd67066 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 61cf881f..345362fd 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", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, macos-latest] 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],