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

Method build_a_library

numpy/distutils/command/build_clib.py:212–469  ·  view source on GitHub ↗
(self, build_info, lib_name, libraries)

Source from the content-addressed store, hash-verified

210 return out_flags
211
212 def build_a_library(self, build_info, lib_name, libraries):
213 # default compilers
214 compiler = self.compiler
215 fcompiler = self._f_compiler
216
217 sources = build_info.get('sources')
218 if sources is None or not is_sequence(sources):
219 raise DistutilsSetupError(("in 'libraries' option (library '%s'), " +
220 "'sources' must be present and must be " +
221 "a list of source filenames") % lib_name)
222 sources = list(sources)
223
224 c_sources, cxx_sources, f_sources, fmodule_sources \
225 = filter_sources(sources)
226 requiref90 = not not fmodule_sources or \
227 build_info.get('language', 'c') == 'f90'
228
229 # save source type information so that build_ext can use it.
230 source_languages = []
231 if c_sources:
232 source_languages.append('c')
233 if cxx_sources:
234 source_languages.append('c++')
235 if requiref90:
236 source_languages.append('f90')
237 elif f_sources:
238 source_languages.append('f77')
239 build_info['source_languages'] = source_languages
240
241 lib_file = compiler.library_filename(lib_name,
242 output_dir=self.build_clib)
243 depends = sources + build_info.get('depends', [])
244
245 force_rebuild = self.force
246 if not self.disable_optimization and not self.compiler_opt.is_cached():
247 log.debug("Detected changes on compiler optimizations")
248 force_rebuild = True
249 if not (force_rebuild or newer_group(depends, lib_file, 'newer')):
250 log.debug("skipping '%s' library (up-to-date)", lib_name)
251 return
252 else:
253 log.info("building '%s' library", lib_name)
254
255 config_fc = build_info.get('config_fc', {})
256 if fcompiler is not None and config_fc:
257 log.info('using additional config_fc from setup script '
258 'for fortran compiler: %s'
259 % (config_fc,))
260 from numpy.distutils.fcompiler import new_fcompiler
261 fcompiler = new_fcompiler(compiler=fcompiler.compiler_type,
262 verbose=self.verbose,
263 dry_run=self.dry_run,
264 force=self.force,
265 requiref90=requiref90,
266 c_compiler=self.compiler)
267 if fcompiler is not None:
268 dist = self.distribution
269 base_config_fc = dist.get_option_dict('config_fc').copy()

Callers 1

build_librariesMethod · 0.95

Calls 15

assemble_flagsMethod · 0.95
is_sequenceFunction · 0.90
filter_sourcesFunction · 0.90
new_fcompilerFunction · 0.90
get_numpy_include_dirsFunction · 0.90
openFunction · 0.85
is_cachedMethod · 0.80
infoMethod · 0.80
updateMethod · 0.80
customizeMethod · 0.80
endswithMethod · 0.80
cpu_baseline_flagsMethod · 0.80

Tested by

no test coverage detected