MCPcopy Create free account
hub / github.com/numpy/numpy / build_project

Function build_project

runtests.py:407–558  ·  view source on GitHub ↗

Build a dev version of the project. Returns ------- site_dir site-packages directory where it was installed

(args)

Source from the content-addressed store, hash-verified

405 sys.exit(1)
406
407def build_project(args):
408 """
409 Build a dev version of the project.
410
411 Returns
412 -------
413 site_dir
414 site-packages directory where it was installed
415
416 """
417
418 import sysconfig
419
420 root_ok = [os.path.exists(os.path.join(ROOT_DIR, fn))
421 for fn in PROJECT_ROOT_FILES]
422 if not all(root_ok):
423 print("To build the project, run runtests.py in "
424 "git checkout or unpacked source")
425 sys.exit(1)
426
427 dst_dir = os.path.join(ROOT_DIR, 'build', 'testenv')
428
429 env = dict(os.environ)
430 cmd = [sys.executable, 'setup.py']
431
432 # Always use ccache, if installed
433 env['PATH'] = os.pathsep.join(EXTRA_PATH + env.get('PATH', '').split(os.pathsep))
434 cvars = sysconfig.get_config_vars()
435 compiler = env.get('CC') or cvars.get('CC', '')
436 if 'gcc' in compiler:
437 # Check that this isn't clang masquerading as gcc.
438 if sys.platform != 'darwin' or 'gnu-gcc' in compiler:
439 # add flags used as werrors
440 warnings_as_errors = ' '.join([
441 # from tools/travis-test.sh
442 '-Werror=vla',
443 '-Werror=nonnull',
444 '-Werror=pointer-arith',
445 '-Wlogical-op',
446 # from sysconfig
447 '-Werror=unused-function',
448 ])
449 env['CFLAGS'] = warnings_as_errors + ' ' + env.get('CFLAGS', '')
450 if args.debug or args.gcov:
451 # assume everyone uses gcc/gfortran
452 env['OPT'] = '-O0 -ggdb'
453 env['FOPT'] = '-O0 -ggdb'
454 if args.gcov:
455 env['OPT'] = '-O0 -ggdb'
456 env['FOPT'] = '-O0 -ggdb'
457 env['CC'] = cvars['CC'] + ' --coverage'
458 env['CXX'] = cvars['CXX'] + ' --coverage'
459 env['F77'] = 'gfortran --coverage '
460 env['F90'] = 'gfortran --coverage '
461 env['LDSHARED'] = cvars['LDSHARED'] + ' --coverage'
462 env['LDFLAGS'] = " ".join(cvars['LDSHARED'].split()[1:]) + ' --coverage'
463
464 cmd += ["build"]

Callers 1

mainFunction · 0.85

Calls 9

printFunction · 0.85
openFunction · 0.85
allFunction · 0.50
existsMethod · 0.45
joinMethod · 0.45
splitMethod · 0.45
getMethod · 0.45
readMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected