Skip to content

Commit

Permalink
Falls back to cpu_count() if no sched_getaffinity()
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix committed Aug 15, 2024
1 parent d68b083 commit a1c909a
Showing 1 changed file with 5 additions and 1 deletion.
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(len(os.sched_getaffinity(0)) 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 a1c909a

Please sign in to comment.