Changeset ef56087 for tests/pybin
- Timestamp:
- Mar 7, 2022, 7:38:52 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 5baa33c
- Parents:
- fc01219
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/pybin/tools.py
rfc01219 ref56087 322 322 # tell make about the pipes 323 323 os.environ["MAKEFLAGS"] = os.environ["MFLAGS"] = " ".join(make_flags) 324 print(os.environ["MFLAGS"])325 324 326 325 # make sure pass the pipes to our children … … 328 327 329 328 return make_flags 329 330 def prep_unlimited_recursive_make(): 331 # prep the flags for make 332 make_flags = ["-j"] 333 334 # tell make about the pipes 335 os.environ["MAKEFLAGS"] = os.environ["MFLAGS"] = "-j" 336 337 return make_flags 338 339 340 def eval_hardware(): 341 # we can create as many things as we want 342 # how much hardware do we have? 343 if settings.distribute: 344 # remote hardware is allowed 345 # how much do we have? 346 ret, jstr = sh("distcc", "-j", output_file=subprocess.PIPE, ignore_dry_run=True) 347 return int(jstr.strip()) if ret == 0 else multiprocessing.cpu_count() 348 else: 349 # remote isn't allowed, use local cpus 350 return multiprocessing.cpu_count() 330 351 331 352 # count number of jobs to create … … 375 396 sys.exit(1) 376 397 377 # we can create as many things as we want 378 # how much hardware do we have? 379 if settings.distribute: 380 # remote hardware is allowed 381 # how much do we have? 382 ret, jstr = sh("distcc", "-j", output_file=subprocess.PIPE, ignore_dry_run=True) 383 options.jobs = int(jstr.strip()) if ret == 0 else multiprocessing.cpu_count() 384 else: 385 # remote isn't allowed, use local cpus 386 options.jobs = multiprocessing.cpu_count() 387 388 make_flags = prep_recursive_make(options.jobs) 398 options.jobs = eval_hardware() 399 flags = prep_unlimited_recursive_make() 389 400 390 401 … … 397 408 398 409 # Arguments are calling the shots, fake the top level make 399 elif options.jobs: 410 elif options.jobs : 411 400 412 # make sure we have a valid number of jobs that corresponds to user input 401 if options.jobs < =0 :413 if options.jobs < 0 : 402 414 print('ERROR: Invalid number of jobs', file=sys.stderr) 403 415 sys.exit(1) 404 416 405 417 flags = prep_recursive_make(options.jobs) 418 419 # Arguments are calling the shots, fake the top level make, but 0 is a special case 420 elif options.jobs == 0: 421 options.jobs = eval_hardware() 422 flags = prep_unlimited_recursive_make() 406 423 407 424 # No one says to run in parallel, then don't … … 412 429 # Make sure we call make as expected 413 430 settings.update_make_cmd( flags ) 431 print(flags) 432 print(os.environ.get('MAKEFLAGS')) 414 433 415 434 # return the job count
Note: See TracChangeset
for help on using the changeset viewer.