Skip to content

Commit

Permalink
Use len(os.sched_getaffinity(0)) instead of os.cpu_count() (#591)
Browse files Browse the repository at this point in the history
Co-authored-by: Fantix King <[email protected]>
  • Loading branch information
avkarenow and fantix authored Aug 15, 2024
1 parent 7777852 commit c8531c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit c8531c2

Please sign in to comment.