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)
| 232 | replace_method(CCompiler, 'object_filenames', CCompiler_object_filenames) |
| 233 | |
| 234 | def 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: |
nothing calls this directly
no test coverage detected