File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -97,12 +97,15 @@ def build_isa_l():
97
97
build_env = os .environ .copy ()
98
98
# Add -fPIC flag to allow static compilation
99
99
build_env ["CFLAGS" ] = build_env .get ("CFLAGS" , "" ) + " -fPIC"
100
-
100
+ if hasattr (os , "sched_getaffinity" ):
101
+ cpu_count = len (os .sched_getaffinity (0 ))
102
+ else : # sched_getaffinity not available on all platforms
103
+ cpu_count = os .cpu_count () or 1 # os.cpu_count() can return None
101
104
run_args = dict (cwd = build_dir , env = build_env )
102
105
subprocess .run (os .path .join (build_dir , "autogen.sh" ), ** run_args )
103
106
subprocess .run ([os .path .join (build_dir , "configure" ),
104
107
"--prefix" , temp_prefix ], ** run_args )
105
- subprocess .run (["make" , "-j" , str (len ( os . sched_getaffinity ( 0 )) )],
108
+ subprocess .run (["make" , "-j" , str (cpu_count )],
106
109
** run_args )
107
110
subprocess .run (["make" , "install" ], ** run_args )
108
111
shutil .rmtree (build_dir )
You can’t perform that action at this time.
0 commit comments