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

Function CCompiler_compile

numpy/distutils/ccompiler.py:234–372  ·  view source on GitHub ↗

Compile one or more source files. Please refer to the Python distutils API reference for more details. Parameters ---------- sources : list of str A list of filenames output_dir : str, optional Path to the output directory. macros : list of tuples

(self, sources, output_dir=None, macros=None,
                      include_dirs=None, debug=0, extra_preargs=None,
                      extra_postargs=None, depends=None)

Source from the content-addressed store, hash-verified

232replace_method(CCompiler, 'object_filenames', CCompiler_object_filenames)
233
234def CCompiler_compile(self, sources, output_dir=None, macros=None,
235 include_dirs=None, debug=0, extra_preargs=None,
236 extra_postargs=None, depends=None):
237 """
238 Compile one or more source files.
239
240 Please refer to the Python distutils API reference for more details.
241
242 Parameters
243 ----------
244 sources : list of str
245 A list of filenames
246 output_dir : str, optional
247 Path to the output directory.
248 macros : list of tuples
249 A list of macro definitions.
250 include_dirs : list of str, optional
251 The directories to add to the default include file search path for
252 this compilation only.
253 debug : bool, optional
254 Whether or not to output debug symbols in or alongside the object
255 file(s).
256 extra_preargs, extra_postargs : ?
257 Extra pre- and post-arguments.
258 depends : list of str, optional
259 A list of file names that all targets depend on.
260
261 Returns
262 -------
263 objects : list of str
264 A list of object file names, one per source file `sources`.
265
266 Raises
267 ------
268 CompileError
269 If compilation fails.
270
271 """
272 global _job_semaphore
273
274 jobs = get_num_build_jobs()
275
276 # setup semaphore to not exceed number of compile jobs when parallelized at
277 # extension level (python >= 3.5)
278 with _global_lock:
279 if _job_semaphore is None:
280 _job_semaphore = threading.Semaphore(jobs)
281
282 if not sources:
283 return []
284 from numpy.distutils.fcompiler import (FCompiler,
285 FORTRAN_COMMON_FIXED_EXTENSIONS,
286 has_f90_header)
287 if isinstance(self, FCompiler):
288 display = []
289 for fc in ['f77', 'f90', 'fix']:
290 fcomp = getattr(self, 'compiler_'+fc)
291 if fcomp is None:

Callers

nothing calls this directly

Calls 8

get_num_build_jobsFunction · 0.90
cyg2win32Function · 0.90
has_f90_headerFunction · 0.90
single_compileFunction · 0.85
infoMethod · 0.80
keysMethod · 0.80
lowerMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected