This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'numpy-1.10' into mpl-1.5.0
- Loading branch information
Showing
1 changed file
with
305 additions
and
0 deletions.
There are no files selected for viewing
305 changes: 305 additions & 0 deletions
305
build/pkgs/numpy/patches/numpy-1.10.1-revert-mingwinpy.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,305 @@ | ||
Francois Bissey: this causes build failures on arm | ||
|
||
From a08437e12d6b6796f4b0beda49bce9adc37db63d Mon Sep 17 00:00:00 2001 | ||
From: Charles Harris <charlesr.harris@gmail.com> | ||
Date: Tue, 20 Oct 2015 08:59:26 -0600 | ||
Subject: [PATCH] Revert "Merge pull request #5614 from | ||
charris/cleanup-gh-5587" | ||
|
||
Revert mingwpy modifications to distutils. They are causing problems | ||
for non-windows builds and it is better to wait until mingypy is | ||
further along. | ||
|
||
This reverts commit 96abd32de241864ee97f30357234cbc9a96c43ae, reversing | ||
changes made to 06af9918f6bf03b8d818ec834f9fb48db57d1489. | ||
--- | ||
INSTALL.txt | 32 ------------- | ||
numpy/core/src/multiarray/multiarraymodule.c | 9 ++++ | ||
numpy/distutils/fcompiler/gnu.py | 32 +++++-------- | ||
numpy/distutils/mingw32ccompiler.py | 67 +++++++++------------------- | ||
numpy/distutils/system_info.py | 18 -------- | ||
numpy/lib/tests/test_function_base.py | 2 +- | ||
setup.py | 1 - | ||
7 files changed, 42 insertions(+), 119 deletions(-) | ||
|
||
diff --git a/INSTALL.txt b/INSTALL.txt | ||
index 12fb47d..6339cbb 100644 | ||
--- a/INSTALL.txt | ||
+++ b/INSTALL.txt | ||
@@ -152,38 +152,6 @@ is broken). gcc 4.4 will hopefully be able to run natively. | ||
This is the only tested way to get a numpy with a FULL blas/lapack (scipy | ||
does not work because of C++). | ||
|
||
-Carl Kleffner's mingw-w64 toolchain | ||
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
- | ||
-Carl Kleffner has been working on mingw-w64 / OpenBLAS support and has put | ||
-together toolchains for that option. The toolchains are available at | ||
-https://bitbucket.org/carlkl/mingw-w64-for-python/downloads. The site.cfg | ||
-should be configured like so: | ||
- | ||
- [openblas] | ||
- libraries = openblaspy | ||
- library_dirs = <openblaspath>/lib | ||
- include_dirs = <openblaspath>/include | ||
- | ||
-The libopenblaspy.dll from <openblaspath>/bin must be copied to numpy/core | ||
-before the build. For this mingw-w64 toolchain manual creation of the python | ||
-import libs is necessary, i.e.: | ||
- | ||
- gendef python2.7.dll | ||
- dlltool -D python27.dll -d python27.def -l libpython27.dll.a | ||
- move libpython27.dll.a libs\libpython27.dll.a | ||
- | ||
-For python-2.6 up to python 3.2 use | ||
-https://bitbucket.org/carlkl/mingw-w64-for-python/downloads/mingwpy_win32_vc90.tar.xz | ||
-or | ||
-https://bitbucket.org/carlkl/mingw-w64-for-python/downloads/mingwpy_amd64_vc90.tar.xz | ||
- | ||
-For python-3.3 and python-3.4 use | ||
-https://bitbucket.org/carlkl/mingw-w64-for-python/downloads/mingwpy_win32_vc100.tar.xz | ||
-or | ||
-https://bitbucket.org/carlkl/mingw-w64-for-python/downloads/mingwpy_amd64_vc100.tar.xz | ||
- | ||
- | ||
MS compilers | ||
------------ | ||
|
||
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c | ||
index 2c694f9..10c22ae 100644 | ||
--- a/numpy/core/src/multiarray/multiarraymodule.c | ||
+++ b/numpy/core/src/multiarray/multiarraymodule.c | ||
@@ -4524,6 +4524,15 @@ PyMODINIT_FUNC initmultiarray(void) { | ||
goto err; | ||
} | ||
|
||
+#if defined(MS_WIN64) && defined(__GNUC__) | ||
+ PyErr_WarnEx(PyExc_Warning, | ||
+ "Numpy built with MINGW-W64 on Windows 64 bits is experimental, " \ | ||
+ "and only available for \n" \ | ||
+ "testing. You are advised not to use it for production. \n\n" \ | ||
+ "CRASHES ARE TO BE EXPECTED - PLEASE REPORT THEM TO NUMPY DEVELOPERS", | ||
+ 1); | ||
+#endif | ||
+ | ||
/* Initialize access to the PyDateTime API */ | ||
numpy_pydatetime_import(); | ||
|
||
diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py | ||
index a7fd3a7..37be080 100644 | ||
--- a/numpy/distutils/fcompiler/gnu.py | ||
+++ b/numpy/distutils/fcompiler/gnu.py | ||
@@ -20,8 +20,6 @@ | ||
# XXX: handle cross compilation | ||
def is_win64(): | ||
return sys.platform == "win32" and platform.architecture()[0] == "64bit" | ||
-def is_win32(): | ||
- return sys.platform == "win32" and platform.architecture()[0] == "32bit" | ||
|
||
if is_win64(): | ||
#_EXTRAFLAGS = ["-fno-leading-underscore"] | ||
@@ -138,7 +136,7 @@ def get_flags_linker_so(self): | ||
|
||
opt.extend(['-undefined', 'dynamic_lookup', '-bundle']) | ||
else: | ||
- opt.append("-shared -Wl,-gc-sections -Wl,-s") | ||
+ opt.append("-shared") | ||
if sys.platform.startswith('sunos'): | ||
# SunOS often has dynamically loaded symbols defined in the | ||
# static library libg2c.a The linker doesn't like this. To | ||
@@ -210,18 +208,9 @@ def get_flags_opt(self): | ||
# With this compiler version building Fortran BLAS/LAPACK | ||
# with -O3 caused failures in lib.lapack heevr,syevr tests. | ||
opt = ['-O2'] | ||
- elif v and v >= '4.6.0': | ||
- if is_win32(): | ||
- # use -mincoming-stack-boundary=2 | ||
- # due to the change to 16 byte stack alignment since GCC 4.6 | ||
- # but 32 bit Windows ABI defines 4 bytes stack alignment | ||
- opt = ['-O2 -march=core2 -mtune=generic -mfpmath=sse -msse2 ' | ||
- '-mincoming-stack-boundary=2'] | ||
- else: | ||
- opt = ['-O2 -march=x86-64 -DMS_WIN64 -mtune=generic -msse2'] | ||
else: | ||
- opt = ['-O2'] | ||
- | ||
+ opt = ['-O3'] | ||
+ opt.append('-funroll-loops') | ||
return opt | ||
|
||
def _c_arch_flags(self): | ||
@@ -361,7 +350,10 @@ def get_target(self): | ||
return "" | ||
|
||
def get_flags_opt(self): | ||
- return GnuFCompiler.get_flags_opt(self) | ||
+ if is_win64(): | ||
+ return ['-O0'] | ||
+ else: | ||
+ return GnuFCompiler.get_flags_opt(self) | ||
|
||
def _can_target(cmd, arch): | ||
"""Return true if the architecture supports the -arch flag""" | ||
@@ -386,13 +378,9 @@ def _can_target(cmd, arch): | ||
from distutils import log | ||
log.set_verbosity(2) | ||
|
||
- try: | ||
- compiler = GnuFCompiler() | ||
- compiler.customize() | ||
- print(compiler.get_version()) | ||
- except Exception: | ||
- msg = get_exception() | ||
- print(msg) | ||
+ compiler = GnuFCompiler() | ||
+ compiler.customize() | ||
+ print(compiler.get_version()) | ||
|
||
try: | ||
compiler = Gnu95FCompiler() | ||
diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py | ||
index f72c3bb..d22a281 100644 | ||
--- a/numpy/distutils/mingw32ccompiler.py | ||
+++ b/numpy/distutils/mingw32ccompiler.py | ||
@@ -87,30 +87,17 @@ def __init__ (self, | ||
elif self.linker_dll == 'gcc': | ||
self.linker = 'g++' | ||
|
||
- p = subprocess.Popen(['gcc', '--version'], shell=True, | ||
- stdout=subprocess.PIPE) | ||
- out_string = p.stdout.read() | ||
- p.stdout.close() | ||
- | ||
- # Before build with MinGW-W64 generate the python import library | ||
- # with gendef and dlltool according to the MingW-W64 FAQ. | ||
- # Use the MinGW-W64 provided msvc runtime import libraries. | ||
- # Don't call build_import_library() and build_msvcr_library. | ||
- | ||
- if 'MinGW-W64' not in str(out_string): | ||
- | ||
- # **changes: eric jones 4/11/01 | ||
- # 1. Check for import library on Windows. Build if it doesn't | ||
- # exist. | ||
- build_import_library() | ||
- | ||
- # Check for custom msvc runtime library on Windows. Build if it | ||
- # doesn't exist. | ||
- msvcr_success = build_msvcr_library() | ||
- msvcr_dbg_success = build_msvcr_library(debug=True) | ||
- if msvcr_success or msvcr_dbg_success: | ||
- # add preprocessor statement for using customized msvcr lib | ||
- self.define_macro('NPY_MINGW_USE_CUSTOM_MSVCR') | ||
+ # **changes: eric jones 4/11/01 | ||
+ # 1. Check for import library on Windows. Build if it doesn't exist. | ||
+ | ||
+ build_import_library() | ||
+ | ||
+ # Check for custom msvc runtime library on Windows. Build if it doesn't exist. | ||
+ msvcr_success = build_msvcr_library() | ||
+ msvcr_dbg_success = build_msvcr_library(debug=True) | ||
+ if msvcr_success or msvcr_dbg_success: | ||
+ # add preprocessor statement for using customized msvcr lib | ||
+ self.define_macro('NPY_MINGW_USE_CUSTOM_MSVCR') | ||
|
||
# Define the MSVC version as hint for MinGW | ||
msvcr_version = '0x%03i0' % int(msvc_runtime_library().lstrip('msvcr')) | ||
@@ -131,12 +118,10 @@ def __init__ (self, | ||
else: | ||
# gcc-4 series releases do not support -mno-cygwin option | ||
self.set_executables( | ||
- compiler='gcc -march=x86-64 -mtune=generic -DMS_WIN64' | ||
- ' -O2 -msse2 -Wall', | ||
- compiler_so='gcc -march=x86-64 -mtune=generic -DMS_WIN64' | ||
- ' -O2 -msse2 -Wall -Wstrict-prototypes', | ||
- linker_exe='gcc', | ||
- linker_so='gcc -shared -Wl,-gc-sections -Wl,-s') | ||
+ compiler='gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall', | ||
+ compiler_so='gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes', | ||
+ linker_exe='gcc -g', | ||
+ linker_so='gcc -g -shared') | ||
else: | ||
if self.gcc_version <= "3.0.0": | ||
self.set_executables( | ||
@@ -154,21 +139,13 @@ def __init__ (self, | ||
linker_exe='g++ -mno-cygwin', | ||
linker_so='g++ -mno-cygwin -shared') | ||
else: | ||
- # gcc-4 series releases do not support -mno-cygwin option i686 | ||
- # build needs '-mincoming-stack-boundary=2' due to ABI | ||
- # incompatibility to Win32 ABI | ||
- self.set_executables( | ||
- compiler='gcc -O2 -march=core2 -mtune=generic' | ||
- ' -mfpmath=sse -msse2' | ||
- ' -mincoming-stack-boundary=2 -Wall', | ||
- compiler_so='gcc -O2 -march=core2 -mtune=generic' | ||
- ' -mfpmath=sse -msse2' | ||
- ' -mincoming-stack-boundary=2 -Wall' | ||
- ' -Wstrict-prototypes', | ||
- linker_exe='g++ ', | ||
- linker_so='g++ -shared -Wl,-gc-sections -Wl,-s') | ||
- # added for python2.3 support we can't pass it through set_executables | ||
- # because pre 2.2 would fail | ||
+ # gcc-4 series releases do not support -mno-cygwin option | ||
+ self.set_executables(compiler='gcc -O2 -Wall', | ||
+ compiler_so='gcc -O2 -Wall -Wstrict-prototypes', | ||
+ linker_exe='g++ ', | ||
+ linker_so='g++ -shared') | ||
+ # added for python2.3 support | ||
+ # we can't pass it through set_executables because pre 2.2 would fail | ||
self.compiler_cxx = ['g++'] | ||
|
||
# Maybe we should also append -mthreads, but then the finished dlls | ||
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py | ||
index 9dd48e2..0da13a7 100644 | ||
--- a/numpy/distutils/system_info.py | ||
+++ b/numpy/distutils/system_info.py | ||
@@ -1751,24 +1751,6 @@ def check_embedded_lapack(self, info): | ||
res = False | ||
finally: | ||
shutil.rmtree(tmpdir) | ||
- if sys.platform == 'win32' and not res: | ||
- c = distutils.ccompiler.new_compiler(compiler='mingw32') | ||
- tmpdir = tempfile.mkdtemp() | ||
- src = os.path.join(tmpdir, 'source.c') | ||
- out = os.path.join(tmpdir, 'a.out') | ||
- try: | ||
- with open(src, 'wt') as f: | ||
- f.write(s) | ||
- obj = c.compile([src], output_dir=tmpdir) | ||
- try: | ||
- c.link_executable(obj, out, libraries=info['libraries'], | ||
- library_dirs=info['library_dirs'], | ||
- extra_postargs=extra_args) | ||
- res = True | ||
- except distutils.ccompiler.LinkError: | ||
- res = False | ||
- finally: | ||
- shutil.rmtree(tmpdir) | ||
return res | ||
|
||
|
||
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py | ||
index 4516c92..3a4ffd7 100644 | ||
--- a/numpy/lib/tests/test_function_base.py | ||
+++ b/numpy/lib/tests/test_function_base.py | ||
@@ -732,7 +732,7 @@ def test_ufunc(self): | ||
args = np.array([0, 0.5 * np.pi, np.pi, 1.5 * np.pi, 2 * np.pi]) | ||
r1 = f(args) | ||
r2 = np.cos(args) | ||
- assert_array_almost_equal(r1, r2) | ||
+ assert_array_equal(r1, r2) | ||
|
||
def test_keywords(self): | ||
|
||
diff --git a/setup.py b/setup.py | ||
index 8e5c3d0..8f4a989 100755 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -221,7 +221,6 @@ def setup_package(): | ||
platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], | ||
test_suite='nose.collector', | ||
cmdclass={"sdist": sdist_checked}, | ||
- package_data={'numpy.core': ['libopenblaspy.dll']}, | ||
) | ||
|
||
# Run build |