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

Function _c_compile

numpy/testing/_private/extbuild.py:181–209  ·  view source on GitHub ↗
(cfile, outputfilename, include_dirs=[], libraries=[],
               library_dirs=[])

Source from the content-addressed store, hash-verified

179
180
181def _c_compile(cfile, outputfilename, include_dirs=[], libraries=[],
182 library_dirs=[]):
183 if sys.platform == 'win32':
184 compile_extra = ["/we4013"]
185 link_extra = ["/LIBPATH:" + os.path.join(sys.base_prefix, 'libs')]
186 elif sys.platform.startswith('linux'):
187 compile_extra = [
188 "-O0", "-g", "-Werror=implicit-function-declaration", "-fPIC"]
189 link_extra = []
190 else:
191 compile_extra = link_extra = []
192 pass
193 if sys.platform == 'win32':
194 link_extra = link_extra + ['/DEBUG'] # generate .pdb file
195 if sys.platform == 'darwin':
196 # support Fink & Darwinports
197 for s in ('/sw/', '/opt/local/'):
198 if (s + 'include' not in include_dirs
199 and os.path.exists(s + 'include')):
200 include_dirs.append(s + 'include')
201 if s + 'lib' not in library_dirs and os.path.exists(s + 'lib'):
202 library_dirs.append(s + 'lib')
203
204 outputfilename = outputfilename.with_suffix(get_so_suffix())
205 build(
206 cfile, outputfilename,
207 compile_extra, link_extra,
208 include_dirs, libraries, library_dirs)
209 return outputfilename
210
211
212def build(cfile, outputfilename, compile_extra, link_extra,

Callers 1

compile_extension_moduleFunction · 0.85

Calls 5

get_so_suffixFunction · 0.85
startswithMethod · 0.80
buildFunction · 0.70
joinMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected