Commit 3747c6db authored by Roman Yurchak's avatar Roman Yurchak

Patch mmap

parent 7358049b
...@@ -23,6 +23,7 @@ source: ...@@ -23,6 +23,7 @@ source:
- patches/dummy_threading.patch - patches/dummy_threading.patch
- patches/skip_ellip_harm_2_pyx_ctypes.patch - patches/skip_ellip_harm_2_pyx_ctypes.patch
- patches/skip_optimize_cobyla_import.patch - patches/skip_optimize_cobyla_import.patch
- patches/fix_mmap.patch
build: build:
cflags: -I../../CLAPACK-WA/INCLUDE -Wno-implicit-function-declaration cflags: -I../../CLAPACK-WA/INCLUDE -Wno-implicit-function-declaration
......
commit 3f9694b956a2c900f92b635e28ea0eed4baed2fa
Author: Roman Yurchak <rth.yurchak@pm.me>
Date: Fri Oct 19 17:16:05 2018 +0200
Workaround for missing BLAS/LAPACK imports
diff --git a/scipy/linalg/blas.py b/scipy/linalg/blas.py
index e4bd57aa4..b88d2f7ea 100644
--- a/scipy/linalg/blas.py
+++ b/scipy/linalg/blas.py
@@ -152,7 +152,10 @@ __all__ = ['get_blas_funcs', 'find_best_blas_type']
import numpy as _np
-from scipy.linalg import _fblas
+try:
+ from scipy.linalg import _fblas
+except ImportError:
+ _fblas = None
try:
from scipy.linalg import _cblas
except ImportError:
@@ -160,7 +163,10 @@ except ImportError:
# Expose all functions (only fblas --- cblas is an implementation detail)
empty_module = None
-from scipy.linalg._fblas import *
+try:
+ from scipy.linalg._fblas import *
+except ImportError:
+ pass
del empty_module
# 'd' will be default for 'i',..
diff --git a/scipy/linalg/lapack.py b/scipy/linalg/lapack.py
index bc712c4ea..29d59085d 100644
--- a/scipy/linalg/lapack.py
+++ b/scipy/linalg/lapack.py
@@ -359,7 +359,10 @@ from .blas import _get_funcs
# Backward compatibility:
from .blas import find_best_blas_type as find_best_lapack_type
-from scipy.linalg import _flapack
+try:
+ from scipy.linalg import _flapack
+except ImportError:
+ _flapack = None
try:
from scipy.linalg import _clapack
except ImportError:
@@ -367,12 +370,18 @@ except ImportError:
# Backward compatibility
from scipy._lib._util import DeprecatedImport as _DeprecatedImport
-clapack = _DeprecatedImport("scipy.linalg.blas.clapack", "scipy.linalg.lapack")
-flapack = _DeprecatedImport("scipy.linalg.blas.flapack", "scipy.linalg.lapack")
+try:
+ clapack = _DeprecatedImport("scipy.linalg.blas.clapack", "scipy.linalg.lapack")
+ flapack = _DeprecatedImport("scipy.linalg.blas.flapack", "scipy.linalg.lapack")
+except ImportError:
+ pass
# Expose all functions (only flapack --- clapack is an implementation detail)
empty_module = None
-from scipy.linalg._flapack import *
+try:
+ from scipy.linalg._flapack import *
+except ImportError:
+ pass
del empty_module
_dep_message = """The `*gegv` family of routines has been deprecated in
@@ -380,17 +389,20 @@ LAPACK 3.6.0 in favor of the `*ggev` family of routines.
The corresponding wrappers will be removed from SciPy in
a future release."""
-cgegv = _np.deprecate(cgegv, old_name='cgegv', message=_dep_message)
-dgegv = _np.deprecate(dgegv, old_name='dgegv', message=_dep_message)
-sgegv = _np.deprecate(sgegv, old_name='sgegv', message=_dep_message)
-zgegv = _np.deprecate(zgegv, old_name='zgegv', message=_dep_message)
-
-# Modyfy _flapack in this scope so the deprecation warnings apply to
-# functions returned by get_lapack_funcs.
-_flapack.cgegv = cgegv
-_flapack.dgegv = dgegv
-_flapack.sgegv = sgegv
-_flapack.zgegv = zgegv
+try:
+ cgegv = _np.deprecate(cgegv, old_name='cgegv', message=_dep_message)
+ dgegv = _np.deprecate(dgegv, old_name='dgegv', message=_dep_message)
+ sgegv = _np.deprecate(sgegv, old_name='sgegv', message=_dep_message)
+ zgegv = _np.deprecate(zgegv, old_name='zgegv', message=_dep_message)
+
+ # Modyfy _flapack in this scope so the deprecation warnings apply to
+ # functions returned by get_lapack_funcs.
+ _flapack.cgegv = cgegv
+ _flapack.dgegv = dgegv
+ _flapack.sgegv = sgegv
+ _flapack.zgegv = zgegv
+except Exception:
+ pass
# some convenience alias for complex functions
_lapack_alias = {
commit 0822e53ae255433469257625e8f292abd13ae562 commit e85d4402a802160b13e49d34728f4358e5337848
Author: Roman Yurchak <rth.yurchak@pm.me> Author: Roman Yurchak <rth.yurchak@pm.me>
Date: Thu Oct 11 17:10:36 2018 +0200 Date: Thu Oct 11 17:10:36 2018 +0200
...@@ -6,8 +6,22 @@ Date: Thu Oct 11 17:10:36 2018 +0200 ...@@ -6,8 +6,22 @@ Date: Thu Oct 11 17:10:36 2018 +0200
scipy.integrate.odepack scipy.integrate.odepack
diff --git a/scipy/integrate/odepack.py b/scipy/integrate/odepack.py
index eee2b04a3..17224f54e 100644
--- a/scipy/integrate/odepack.py
+++ b/scipy/integrate/odepack.py
@@ -3,7 +3,8 @@ from __future__ import division, print_function, absolute_import
__all__ = ['odeint']
-from . import _odepack
+# from . import _odepack
+_odepack = None
from copy import copy
import warnings
diff --git a/scipy/integrate/setup.py b/scipy/integrate/setup.py diff --git a/scipy/integrate/setup.py b/scipy/integrate/setup.py
index 9d607af8d..2be454c70 100755 index 4725eb1c0..0545dc759 100755
--- a/scipy/integrate/setup.py --- a/scipy/integrate/setup.py
+++ b/scipy/integrate/setup.py +++ b/scipy/integrate/setup.py
@@ -27,7 +27,7 @@ def configuration(parent_package='',top_path=None): @@ -27,7 +27,7 @@ def configuration(parent_package='',top_path=None):
...@@ -63,7 +77,7 @@ index 9d607af8d..2be454c70 100755 ...@@ -63,7 +77,7 @@ index 9d607af8d..2be454c70 100755
+ # **lapack_opt) + # **lapack_opt)
# dop # dop
config.add_extension('_dop', #config.add_extension('_dop',
@@ -76,11 +76,11 @@ def configuration(parent_package='',top_path=None): @@ -76,11 +76,11 @@ def configuration(parent_package='',top_path=None):
sources=quadpack_test_src) sources=quadpack_test_src)
......
from pathlib import Path
import subprocess
import sys
from textwrap import dedent from textwrap import dedent
import pytest import pytest
sys.path.append(str(Path(__file__).parents[2]))
from pyodide_build.common import HOSTPYTHON # noqa: E402
def test_scipy_import(selenium_standalone, request): def test_scipy_import(selenium_standalone, request):
from selenium.common.exceptions import JavascriptException from selenium.common.exceptions import JavascriptException
...@@ -41,6 +34,32 @@ def test_scipy_import(selenium_standalone, request): ...@@ -41,6 +34,32 @@ def test_scipy_import(selenium_standalone, request):
print(selenium.logs) print(selenium.logs)
def test_scipy_linalg(selenium_standalone):
selenium = selenium_standalone
selenium.load_package("scipy")
cmd = dedent(r"""
import numpy as np
import scipy as sp
import scipy.linalg
from numpy.testing import assert_allclose
N = 10
X = np.random.RandomState(42).rand(N, N)
X_inv = scipy.linalg.inv(X)
res = X.dot(X_inv)
assert_allclose(res, np.identity(N),
rtol=1e-07, atol=1e-9)
""")
selenium.run(cmd)
print(selenium.logs)
@pytest.mark.skip
def test_built_so(selenium_standalone): def test_built_so(selenium_standalone):
selenium = selenium_standalone selenium = selenium_standalone
selenium.load_package("scipy") selenium.load_package("scipy")
...@@ -61,19 +80,11 @@ def test_built_so(selenium_standalone): ...@@ -61,19 +80,11 @@ def test_built_so(selenium_standalone):
out out
""") """)
out = subprocess.check_output(
[HOSTPYTHON / 'bin' / 'python3', '-c', cmd])
modules_host = out.decode('utf-8').split('\n')
def _get_modules_name(modules): def _get_modules_name(modules):
return set([path.split('.')[0] for path in modules if path]) return set([path.split('.')[0] for path in modules if path])
modules_host = _get_modules_name(modules_host)
modules_target = selenium.run(cmd) modules_target = selenium.run(cmd)
modules_target = _get_modules_name(modules_target) modules_target = _get_modules_name(modules_target)
print(f'Included modules: {len(modules_target)}') print(f'Included modules: {len(modules_target)}')
print(f' {modules_target} ') print(f' {modules_target} ')
print(f'\nMissing modules: {len(modules_host.difference(modules_target))}')
print(f' {modules_host.difference(modules_target)}')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment