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

Method compile

numpy/f2py/_backends/_distutils.py:24–75  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

22 super().__init__(*args, **kwargs)
23
24 def compile(self):
25 num_info = {}
26 if num_info:
27 self.include_dirs.extend(num_info.get("include_dirs", []))
28 ext_args = {
29 "name": self.modulename,
30 "sources": self.sources,
31 "include_dirs": self.include_dirs,
32 "library_dirs": self.library_dirs,
33 "libraries": self.libraries,
34 "define_macros": self.define_macros,
35 "undef_macros": self.undef_macros,
36 "extra_objects": self.extra_objects,
37 "f2py_options": self.f2py_flags,
38 }
39
40 if self.sysinfo_flags:
41 for n in self.sysinfo_flags:
42 i = get_info(n)
43 if not i:
44 print(
45 f"No {repr(n)} resources found"
46 "in system (try `f2py --help-link`)"
47 )
48 dict_append(ext_args, **i)
49
50 ext = Extension(**ext_args)
51
52 sys.argv = [sys.argv[0]] + self.setup_flags
53 sys.argv.extend(
54 [
55 "build",
56 "--build-temp",
57 self.build_dir,
58 "--build-base",
59 self.build_dir,
60 "--build-platlib",
61 ".",
62 "--disable-optimization",
63 ]
64 )
65
66 if self.fc_flags:
67 sys.argv.extend(["config_fc"] + self.fc_flags)
68 if self.flib_flags:
69 sys.argv.extend(["build_ext"] + self.flib_flags)
70
71 setup(ext_modules=[ext])
72
73 if self.remove_build_dir and os.path.exists(self.build_dir):
74 print(f"Removing build directory {self.build_dir}")
75 shutil.rmtree(self.build_dir)

Callers

nothing calls this directly

Calls 7

get_infoFunction · 0.90
dict_appendFunction · 0.90
setupFunction · 0.90
printFunction · 0.85
ExtensionClass · 0.85
getMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected