MCPcopy Index your code
hub / github.com/numpy/numpy / compile_extension_module

Function compile_extension_module

numpy/testing/_private/extbuild.py:83–116  ·  view source on GitHub ↗

Build an extension module and return the filename of the resulting native code file. Parameters ---------- name : string name of the module, possibly including dots if it is a module inside a package. builddir : pathlib.Path Where to build the module

(
        name, builddir, include_dirs,
        source_string, libraries=None, library_dirs=None)

Source from the content-addressed store, hash-verified

81
82
83def compile_extension_module(
84 name, builddir, include_dirs,
85 source_string, libraries=None, library_dirs=None):
86 """
87 Build an extension module and return the filename of the resulting
88 native code file.
89
90 Parameters
91 ----------
92 name : string
93 name of the module, possibly including dots if it is a module inside a
94 package.
95 builddir : pathlib.Path
96 Where to build the module, usually a temporary directory
97 include_dirs : list
98 Extra directories to find include files when compiling
99 libraries : list
100 Libraries to link into the extension module
101 library_dirs: list
102 Where to find the libraries, ``-L`` passed to the linker
103 """
104 modname = name.split('.')[-1]
105 dirname = builddir / name
106 dirname.mkdir(exist_ok=True)
107 cfile = _convert_str_to_file(source_string, dirname)
108 include_dirs = include_dirs or []
109 libraries = libraries or []
110 library_dirs = library_dirs or []
111
112 return _c_compile(
113 cfile, outputfilename=dirname / modname,
114 include_dirs=include_dirs, libraries=libraries,
115 library_dirs=library_dirs,
116 )
117
118
119def _convert_str_to_file(source, dirname):

Callers 1

Calls 3

_convert_str_to_fileFunction · 0.85
_c_compileFunction · 0.85
splitMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…