summaryrefslogtreecommitdiff
path: root/numpy/distutils
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/distutils')
-rw-r--r--numpy/distutils/ccompiler.py17
-rw-r--r--numpy/distutils/fcompiler/__init__.py5
-rw-r--r--numpy/distutils/fcompiler/intel.py8
-rw-r--r--numpy/distutils/intelccompiler.py20
-rw-r--r--numpy/distutils/npy_pkg_config.py9
-rw-r--r--numpy/distutils/system_info.py10
-rw-r--r--numpy/distutils/tests/test_fcompiler_intel.py34
7 files changed, 80 insertions, 23 deletions
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
index 011122b60..14213dc4b 100644
--- a/numpy/distutils/ccompiler.py
+++ b/numpy/distutils/ccompiler.py
@@ -17,13 +17,6 @@ from numpy.distutils.misc_util import cyg2win32, is_sequence, mingw32, \
quote_args, msvc_on_amd64
from numpy.distutils.compat import get_exception
-# hack to set compiler optimizing options. Needs to integrated with something.
-import distutils.sysconfig
-_old_init_posix = distutils.sysconfig._init_posix
-def _new_init_posix():
- _old_init_posix()
- distutils.sysconfig._config_vars['OPT'] = '-Wall -g -O0'
-#distutils.sysconfig._init_posix = _new_init_posix
def replace_method(klass, method_name, func):
if sys.version_info[0] < 3:
@@ -346,12 +339,7 @@ def CCompiler_customize(self, dist, need_cxx=0):
if need_cxx:
# In general, distutils uses -Wstrict-prototypes, but this option is
# not valid for C++ code, only for C. Remove it if it's there to
- # avoid a spurious warning on every compilation. All the default
- # options used by distutils can be extracted with:
-
- # from distutils import sysconfig
- # sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS',
- # 'CCSHARED', 'LDSHARED', 'SO')
+ # avoid a spurious warning on every compilation.
try:
self.compiler_so.remove('-Wstrict-prototypes')
except (AttributeError, ValueError):
@@ -506,10 +494,13 @@ compiler_class['intel'] = ('intelccompiler','IntelCCompiler',
"Intel C Compiler for 32-bit applications")
compiler_class['intele'] = ('intelccompiler','IntelItaniumCCompiler',
"Intel C Itanium Compiler for Itanium-based applications")
+compiler_class['intelem'] = ('intelccompiler','IntelEM64TCCompiler',
+ "Intel C Compiler for 64-bit applications")
compiler_class['pathcc'] = ('pathccompiler','PathScaleCCompiler',
"PathScale Compiler for SiCortex-based applications")
ccompiler._default_compilers += (('linux.*','intel'),
('linux.*','intele'),
+ ('linux.*','intelem'),
('linux.*','pathcc'))
if sys.platform == 'win32':
diff --git a/numpy/distutils/fcompiler/__init__.py b/numpy/distutils/fcompiler/__init__.py
index 397b36ce9..d2400459f 100644
--- a/numpy/distutils/fcompiler/__init__.py
+++ b/numpy/distutils/fcompiler/__init__.py
@@ -27,7 +27,7 @@ except NameError:
from numpy.compat import open_latin1
-from distutils.sysconfig import get_config_var, get_python_lib
+from distutils.sysconfig import get_config_var, get_config_vars, get_python_lib
from distutils.fancy_getopt import FancyGetopt
from distutils.errors import DistutilsModuleError, \
DistutilsExecError, CompileError, LinkError, DistutilsPlatformError
@@ -196,6 +196,9 @@ class FCompiler(CCompiler):
src_extensions = ['.for','.ftn','.f77','.f','.f90','.f95','.F','.F90']
obj_extension = ".o"
shared_lib_extension = get_config_var('SO') # or .dll
+ # fix long extension for Python >=3.2, see PEP 3149.
+ if 'SOABI' in get_config_vars():
+ shared_lib_extension = shared_lib_extension.replace('.'+get_config_var('SOABI'), '', 1)
static_lib_extension = ".a" # or .lib
static_lib_format = "lib%s%s" # or %s%s
shared_lib_format = "%s%s"
diff --git a/numpy/distutils/fcompiler/intel.py b/numpy/distutils/fcompiler/intel.py
index d7effb01e..b593a91c7 100644
--- a/numpy/distutils/fcompiler/intel.py
+++ b/numpy/distutils/fcompiler/intel.py
@@ -136,9 +136,9 @@ class IntelItaniumFCompiler(IntelFCompiler):
class IntelEM64TFCompiler(IntelFCompiler):
compiler_type = 'intelem'
compiler_aliases = ()
- description = 'Intel Fortran Compiler for EM64T-based apps'
+ description = 'Intel Fortran Compiler for 64-bit apps'
- version_match = intel_version_match('EM64T-based|Intel\\(R\\) 64')
+ version_match = intel_version_match('EM64T-based|Intel\\(R\\) 64|64|IA-64|64-bit')
possible_executables = ['ifort', 'efort', 'efc']
@@ -165,9 +165,9 @@ class IntelVisualFCompiler(BaseIntelFCompiler):
compiler_type = 'intelv'
description = 'Intel Visual Fortran Compiler for 32-bit apps'
version_match = intel_version_match('32-bit|IA-32')
-
+
def update_executables(self):
- f = dummy_fortran_file()
+ f = dummy_fortran_file()
self.executables['version_cmd'] = ['<F77>', '/FI', '/c',
f + '.f', '/o', f + '.o']
diff --git a/numpy/distutils/intelccompiler.py b/numpy/distutils/intelccompiler.py
index e03c5beba..b82445ab8 100644
--- a/numpy/distutils/intelccompiler.py
+++ b/numpy/distutils/intelccompiler.py
@@ -9,9 +9,11 @@ class IntelCCompiler(UnixCCompiler):
compiler_type = 'intel'
cc_exe = 'icc'
+ cc_args = 'fPIC'
def __init__ (self, verbose=0, dry_run=0, force=0):
UnixCCompiler.__init__ (self, verbose,dry_run, force)
+ self.cc_exe = 'icc -fPIC'
compiler = self.cc_exe
self.set_executables(compiler=compiler,
compiler_so=compiler,
@@ -27,3 +29,21 @@ class IntelItaniumCCompiler(IntelCCompiler):
for cc_exe in map(find_executable,['icc','ecc']):
if cc_exe:
break
+
+class IntelEM64TCCompiler(UnixCCompiler):
+
+""" A modified Intel x86_64 compiler compatible with a 64bit gcc built Python.
+ """
+
+ compiler_type = 'intelem'
+ cc_exe = 'icc -m64 -fPIC'
+ cc_args = "-fPIC"
+ def __init__ (self, verbose=0, dry_run=0, force=0):
+ UnixCCompiler.__init__ (self, verbose,dry_run, force)
+ self.cc_exe = 'icc -m64 -fPIC'
+ compiler = self.cc_exe
+ self.set_executables(compiler=compiler,
+ compiler_so=compiler,
+ compiler_cxx=compiler,
+ linker_exe=compiler,
+ linker_so=compiler + ' -shared')
diff --git a/numpy/distutils/npy_pkg_config.py b/numpy/distutils/npy_pkg_config.py
index fed95b921..4f64623ed 100644
--- a/numpy/distutils/npy_pkg_config.py
+++ b/numpy/distutils/npy_pkg_config.py
@@ -2,7 +2,7 @@ import sys
if sys.version_info[0] < 3:
from ConfigParser import SafeConfigParser, NoOptionError
else:
- from configparser import SafeConfigParser, NoOptionError
+ from configparser import ConfigParser, SafeConfigParser, NoOptionError
import re
import os
import shlex
@@ -270,7 +270,12 @@ def parse_config(filename, dirs=None):
else:
filenames = [filename]
- config = SafeConfigParser()
+ if sys.version[:3] > '3.1':
+ # SafeConfigParser is deprecated in py-3.2 and renamed to ConfigParser
+ config = ConfigParser()
+ else:
+ config = SafeConfigParser()
+
n = config.read(filenames)
if not len(n) >= 1:
raise PkgNotFound("Could not find file(s) %s" % str(filenames))
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
index 7cc33eb43..667ca82bc 100644
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -117,9 +117,9 @@ import copy
import warnings
from glob import glob
if sys.version_info[0] < 3:
- from ConfigParser import SafeConfigParser, NoOptionError, ConfigParser
+ from ConfigParser import NoOptionError, ConfigParser
else:
- from configparser import SafeConfigParser, NoOptionError, ConfigParser
+ from configparser import NoOptionError, ConfigParser
from distutils.errors import DistutilsError
from distutils.dist import Distribution
@@ -211,6 +211,10 @@ default_include_dirs = filter(os.path.isdir, default_include_dirs)
default_src_dirs = filter(os.path.isdir, default_src_dirs)
so_ext = distutils.sysconfig.get_config_vars('SO')[0] or ''
+# fix long extension for Python >=3.2, see PEP 3149.
+if 'SOABI' in distutils.sysconfig.get_config_vars():
+ so_ext = so_ext.replace('.'+distutils.sysconfig.get_config_var('SOABI'), '', 1)
+
def get_standard_file(fname):
"""Returns a list of files named 'fname' from
@@ -1324,7 +1328,7 @@ class lapack_opt_info(system_info):
or ('ATLAS_WITHOUT_LAPACK',None) in l:
need_lapack = 1
info = atlas_info
-
+
else:
warnings.warn(AtlasNotFoundError.__doc__)
need_blas = 1
diff --git a/numpy/distutils/tests/test_fcompiler_intel.py b/numpy/distutils/tests/test_fcompiler_intel.py
new file mode 100644
index 000000000..ad03daeea
--- /dev/null
+++ b/numpy/distutils/tests/test_fcompiler_intel.py
@@ -0,0 +1,34 @@
+from numpy.testing import *
+
+import numpy.distutils.fcompiler
+
+intel_32bit_version_strings = [
+ ("Intel(R) Fortran Intel(R) 32-bit Compiler Professional for applications"\
+ "running on Intel(R) 32, Version 11.1", '11.1'),
+]
+
+intel_64bit_version_strings = [
+ ("Intel(R) Fortran IA-64 Compiler Professional for applications"\
+ "running on IA-64, Version 11.0", '11.0'),
+ ("Intel(R) Fortran Intel(R) 64 Compiler Professional for applications"\
+ "running on Intel(R) 64, Version 11.1", '11.1')
+]
+
+class TestIntelFCompilerVersions(TestCase):
+ def test_32bit_version(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='intel')
+ for vs, version in intel_32bit_version_strings:
+ v = fc.version_match(vs)
+ assert_(v == version)
+
+
+class TestIntelEM64TFCompilerVersions(TestCase):
+ def test_64bit_version(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='intelem')
+ for vs, version in intel_64bit_version_strings:
+ v = fc.version_match(vs)
+ assert_(v == version)
+
+
+if __name__ == '__main__':
+ run_module_suite()