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

Method dist_test

numpy/distutils/ccompiler_opt.py:616–640  ·  view source on GitHub ↗

Return True if 'CCompiler.compile()' able to compile a source file with certain flags.

(self, source, flags, macros=[])

Source from the content-addressed store, hash-verified

614 return ccompiler.compile(sources, extra_postargs=flags, **kwargs)
615
616 def dist_test(self, source, flags, macros=[]):
617 """Return True if 'CCompiler.compile()' able to compile
618 a source file with certain flags.
619 """
620 assert(isinstance(source, str))
621 from distutils.errors import CompileError
622 cc = self._ccompiler;
623 bk_spawn = getattr(cc, 'spawn', None)
624 if bk_spawn:
625 cc_type = getattr(self._ccompiler, "compiler_type", "")
626 if cc_type in ("msvc",):
627 setattr(cc, 'spawn', self._dist_test_spawn_paths)
628 else:
629 setattr(cc, 'spawn', self._dist_test_spawn)
630 test = False
631 try:
632 self.dist_compile(
633 [source], flags, macros=macros, output_dir=self.conf_tmp_path
634 )
635 test = True
636 except CompileError as e:
637 self.dist_log(str(e), stderr=True)
638 if bk_spawn:
639 setattr(cc, 'spawn', bk_spawn)
640 return test
641
642 def dist_info(self):
643 """

Callers 4

cc_test_flagsMethod · 0.80
cc_test_cexprMethod · 0.80
feature_testMethod · 0.80
feature_extra_checksMethod · 0.80

Calls 2

dist_compileMethod · 0.95
dist_logMethod · 0.95

Tested by

no test coverage detected