summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2017-06-21 09:55:26 -0600
committerCharles Harris <charlesr.harris@gmail.com>2017-06-26 10:20:41 -0600
commitbb21232753efea0b2af0aee458d52c694ad6959a (patch)
tree3ce43f593881b64a01ae9e52f50969cbe5a90c32 /numpy
parentcfb909f35de8ad238066eb176bc408d86f15c9c8 (diff)
downloadnumpy-bb21232753efea0b2af0aee458d52c694ad6959a.tar.gz
BUG: Fix Intel compilation on Unix.
Fixes two problems: * c compilers do not have a find_executables method. * get_version return a LooseVersion instance, not string. Closes #9278. [ci skip]
Diffstat (limited to 'numpy')
-rw-r--r--numpy/distutils/ccompiler.py20
-rw-r--r--numpy/distutils/fcompiler/intel.py4
-rw-r--r--numpy/distutils/intelccompiler.py4
3 files changed, 24 insertions, 4 deletions
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
index 93ef4587c..bbc3923bd 100644
--- a/numpy/distutils/ccompiler.py
+++ b/numpy/distutils/ccompiler.py
@@ -80,6 +80,7 @@ def _needs_build(obj, cc_args, extra_postargs, pp_opts):
return False
+
def replace_method(klass, method_name, func):
if sys.version_info[0] < 3:
m = types.MethodType(func, None, klass)
@@ -88,6 +89,25 @@ def replace_method(klass, method_name, func):
m = lambda self, *args, **kw: func(self, *args, **kw)
setattr(klass, method_name, m)
+
+######################################################################
+## Method that subclasses may redefine. But don't call this method,
+## it i private to CCompiler class and may return unexpected
+## results if used elsewhere. So, you have been warned..
+
+def CCompiler_find_executables(self):
+ """
+ Does nothing here, but is called by the get_version method and can be
+ overridden by subclasses. In particular it is redefined in the `FCompiler`
+ class where more documentation can be found.
+
+ """
+ pass
+
+
+replace_method(CCompiler, 'find_executables', CCompiler_find_executables)
+
+
# Using customized CCompiler.spawn.
def CCompiler_spawn(self, cmd, display=None):
"""
diff --git a/numpy/distutils/fcompiler/intel.py b/numpy/distutils/fcompiler/intel.py
index eb6150201..4dee8492f 100644
--- a/numpy/distutils/fcompiler/intel.py
+++ b/numpy/distutils/fcompiler/intel.py
@@ -57,7 +57,7 @@ class IntelFCompiler(BaseIntelFCompiler):
def get_flags_opt(self): # Scipy test failures with -O2
v = self.get_version()
- mpopt = 'openmp' if v and int(v.split('.')[0]) < 15 else 'qopenmp'
+ mpopt = 'openmp' if v and v < '15' else 'qopenmp'
return ['-xhost -fp-model strict -O1 -{}'.format(mpopt)]
def get_flags_arch(self):
@@ -123,7 +123,7 @@ class IntelEM64TFCompiler(IntelFCompiler):
def get_flags_opt(self): # Scipy test failures with -O2
v = self.get_version()
- mpopt = 'openmp' if v and int(v.split('.')[0]) < 15 else 'qopenmp'
+ mpopt = 'openmp' if v and v < '15' else 'qopenmp'
return ['-fp-model strict -O1 -{}'.format(mpopt)]
def get_flags_arch(self):
diff --git a/numpy/distutils/intelccompiler.py b/numpy/distutils/intelccompiler.py
index 3b7756b59..3386775ee 100644
--- a/numpy/distutils/intelccompiler.py
+++ b/numpy/distutils/intelccompiler.py
@@ -19,7 +19,7 @@ class IntelCCompiler(UnixCCompiler):
UnixCCompiler.__init__(self, verbose, dry_run, force)
v = self.get_version()
- mpopt = 'openmp' if v and int(v.split('.')[0]) < 15 else 'qopenmp'
+ mpopt = 'openmp' if v and v < '15' else 'qopenmp'
self.cc_exe = ('icc -fPIC -fp-model strict -O3 '
'-fomit-frame-pointer -{}').format(mpopt)
compiler = self.cc_exe
@@ -59,7 +59,7 @@ class IntelEM64TCCompiler(UnixCCompiler):
UnixCCompiler.__init__(self, verbose, dry_run, force)
v = self.get_version()
- mpopt = 'openmp' if v and int(v.split('.')[0]) < 15 else 'qopenmp'
+ mpopt = 'openmp' if v and v < '15' else 'qopenmp'
self.cc_exe = ('icc -m64 -fPIC -fp-model strict -O3 '
'-fomit-frame-pointer -{}').format(mpopt)
compiler = self.cc_exe