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

Function _can_target

numpy/distutils/fcompiler/gnu.py:526–543  ·  view source on GitHub ↗

Return true if the architecture supports the -arch flag

(cmd, arch)

Source from the content-addressed store, hash-verified

524
525
526def _can_target(cmd, arch):
527 """Return true if the architecture supports the -arch flag"""
528 newcmd = cmd[:]
529 fid, filename = tempfile.mkstemp(suffix=".f")
530 os.close(fid)
531 try:
532 d = os.path.dirname(filename)
533 output = os.path.splitext(filename)[0] + ".o"
534 try:
535 newcmd.extend(["-arch", arch, "-c", filename])
536 p = Popen(newcmd, stderr=STDOUT, stdout=PIPE, cwd=d)
537 p.communicate()
538 return p.returncode == 0
539 finally:
540 if os.path.exists(output):
541 os.remove(output)
542 finally:
543 os.remove(filename)
544
545
546if __name__ == '__main__':

Callers 1

_universal_flagsMethod · 0.85

Calls 2

closeMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected