8000 Merge pull request #5425 from mbyt/ensure_OPT_environment_variable_is… · rgommers/numpy@d3e8d69 · GitHub
[go: up one dir, main page]

Skip to content

Commit d3e8d69

Browse files
committed
Merge pull request numpy#5425 from mbyt/ensure_OPT_environment_variable_is_read
BLD: ensure OPT build environment variable is read
2 parents c6b8109 + ed83ae7 commit d3e8d69

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

numpy/distutils/unixccompiler.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts
3030
# add flags for (almost) sane C++ handling
3131
ccomp += ['-AA']
3232
self.compiler_so = ccomp
33+
# ensure OPT environment variable is read
34+
if 'OPT' in os.environ:
35+
from distutils.sysconfig import get_config_vars
36+
opt = " ".join(os.environ['OPT'].split())
37+
gcv_opt = " ".join(get_config_vars('OPT')[0].split())
38+
ccomp_s = " ".join(self.compiler_so)
39+
if opt not in ccomp_s:
40+
ccomp_s = ccomp_s.replace(gcv_opt, opt)
41+
self.compiler_so = ccomp_s.split()
42+
llink_s = " ".join(self.linker_so)
43+
if opt not in llink_s:
44+
self.linker_so = llink_s.split() + opt.split()
3345

3446
display = '%s: %s' % (os.path.basename(self.compiler_so[0]), src)
3547
try:

0 commit comments

Comments
 (0)
0