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

Method run

numpy/distutils/command/build_clib.py:87–175  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

85 return False
86
87 def run(self):
88 if not self.libraries:
89 return
90
91 # Make sure that library sources are complete.
92 languages = []
93
94 # Make sure that extension sources are complete.
95 self.run_command('build_src')
96
97 for (lib_name, build_info) in self.libraries:
98 l = build_info.get('language', None)
99 if l and l not in languages:
100 languages.append(l)
101
102 from distutils.ccompiler import new_compiler
103 self.compiler = new_compiler(compiler=self.compiler,
104 dry_run=self.dry_run,
105 force=self.force)
106 self.compiler.customize(self.distribution,
107 need_cxx=self.have_cxx_sources())
108
109 if self.warn_error:
110 self.compiler.compiler.append('-Werror')
111 self.compiler.compiler_so.append('-Werror')
112
113 libraries = self.libraries
114 self.libraries = None
115 self.compiler.customize_cmd(self)
116 self.libraries = libraries
117
118 self.compiler.show_customization()
119
120 if not self.disable_optimization:
121 dispatch_hpath = os.path.join("numpy", "distutils", "include", "npy_cpu_dispatch_config.h")
122 dispatch_hpath = os.path.join(self.get_finalized_command("build_src").build_src, dispatch_hpath)
123 opt_cache_path = os.path.abspath(
124 os.path.join(self.build_temp, 'ccompiler_opt_cache_clib.py')
125 )
126 if hasattr(self, "compiler_opt"):
127 # By default `CCompilerOpt` update the cache at the exit of
128 # the process, which may lead to duplicate building
129 # (see build_extension()/force_rebuild) if run() called
130 # multiple times within the same os process/thread without
131 # giving the chance the previous instances of `CCompilerOpt`
132 # to update the cache.
133 self.compiler_opt.cache_flush()
134
135 self.compiler_opt = new_ccompiler_opt(
136 compiler=self.compiler, dispatch_hpath=dispatch_hpath,
137 cpu_baseline=self.cpu_baseline, cpu_dispatch=self.cpu_dispatch,
138 cache_path=opt_cache_path
139 )
140 def report(copt):
141 log.info("\n########### CLIB COMPILER OPTIMIZATION ###########")
142 log.info(copt.report(full=True))
143
144 import atexit

Callers

nothing calls this directly

Calls 12

have_cxx_sourcesMethod · 0.95
have_f_sourcesMethod · 0.95
build_librariesMethod · 0.95
new_compilerFunction · 0.90
new_ccompiler_optFunction · 0.90
new_fcompilerFunction · 0.90
customizeMethod · 0.80
cache_flushMethod · 0.80
getMethod · 0.45
joinMethod · 0.45
abspathMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected