Commit 862f2574 authored by Roman Yurchak's avatar Roman Yurchak

Use dummy threading + re-enable C++ files that failed due to a gloabl

namespace
parent 858e6e0a
......@@ -8,6 +8,7 @@
.pytest_cache/
__pycache__
geckodriver.log
firefox/
build
downloads
......
......@@ -16,11 +16,12 @@ source:
# https://github.com/rth/scipy/tree/0.17.1-pyodide
# on top of the v0.17.1 tag
- patches/disable_modules_with_blas.patch
- patches/disable_modules_global_cpp_namespace_issue.patch
- patches/fix-build-gcc5-a80460.patch
- patches/force_malloc.patch
- patches/disable_scipy_stats_mvn.patch
- patches/skip-fortran-fails-to-link.patch
- patches/dummy_threading.patch
- patches/skip-blas-imports.patch
build:
cflags: -I../../CLAPACK-WA/INCLUDE -Wno-implicit-function-declaration
......
commit 0da8a50bd566ee7810ed1888112cc9c9a1b27d9e
Author: Roman Yurchak <rth.yurchak@pm.me>
Date: Wed Oct 10 14:12:22 2018 +0200
Remove modules with global C++ namespace issue
diff --git a/scipy/sparse/setup.py b/scipy/sparse/setup.py
index ecf8ae5c6..27fd128c3 100755
--- a/scipy/sparse/setup.py
+++ b/scipy/sparse/setup.py
@@ -45,17 +45,17 @@ def configuration(parent_package='',top_path=None):
'sparsetools.h',
'util.h']
depends = [os.path.join('sparsetools', hdr) for hdr in depends],
- config.add_extension('_sparsetools',
- define_macros=[('__STDC_FORMAT_MACROS', 1)],
- depends=depends,
- include_dirs=['sparsetools'],
- sources=[os.path.join('sparsetools', 'sparsetools.cxx'),
- os.path.join('sparsetools', 'csr.cxx'),
- os.path.join('sparsetools', 'csc.cxx'),
- os.path.join('sparsetools', 'bsr.cxx'),
- os.path.join('sparsetools', 'other.cxx'),
- get_sparsetools_sources]
- )
+ #config.add_extension('_sparsetools',
+ # define_macros=[('__STDC_FORMAT_MACROS', 1)],
+ # depends=depends,
+ # include_dirs=['sparsetools'],
+ # sources=[os.path.join('sparsetools', 'sparsetools.cxx'),
+ # os.path.join('sparsetools', 'csr.cxx'),
+ # os.path.join('sparsetools', 'csc.cxx'),
+ # os.path.join('sparsetools', 'bsr.cxx'),
+ # os.path.join('sparsetools', 'other.cxx'),
+ # get_sparsetools_sources]
+ # )
return config
diff --git a/scipy/spatial/setup.py b/scipy/spatial/setup.py
index 43b635dec..5b100ac06 100755
--- a/scipy/spatial/setup.py
+++ b/scipy/spatial/setup.py
@@ -58,10 +58,10 @@ def configuration(parent_package='', top_path=None):
ckdtree_headers = [join('ckdtree', 'src', x) for x in ckdtree_headers]
ckdtree_dep = ['ckdtree.cxx'] + ckdtree_headers + ckdtree_src
- config.add_extension('ckdtree',
- sources=['ckdtree.cxx'] + ckdtree_src,
- depends=ckdtree_dep,
- include_dirs=inc_dirs + [join('ckdtree','src')])
+ #config.add_extension('ckdtree',
+ # sources=['ckdtree.cxx'] + ckdtree_src,
+ # depends=ckdtree_dep,
+ # include_dirs=inc_dirs + [join('ckdtree','src')])
# _distance_wrap
config.add_extension('_distance_wrap',
sources=[join('src', 'distance_wrap.c')],
diff --git a/scipy/special/setup.py b/scipy/special/setup.py
index e5efb2e7a..6f75681c0 100755
--- a/scipy/special/setup.py
+++ b/scipy/special/setup.py
@@ -91,18 +91,18 @@ def configuration(parent_package='',top_path=None):
'_faddeeva.cxx', 'Faddeeva.cc']
ufuncs_cxx_dep = (headers + ufuncs_cxx_src + cephes_src
+ ['*.hh'])
- config.add_extension('_ufuncs_cxx',
- sources=ufuncs_cxx_src,
- depends=ufuncs_cxx_dep,
- include_dirs=[curdir],
- define_macros=define_macros,
- extra_info=get_info("npymath"))
-
- cfg = dict(get_system_info('lapack_opt'))
- config.add_extension('_ellip_harm_2',
- sources=['_ellip_harm_2.c', 'sf_error.c',],
- **cfg
- )
+ #config.add_extension('_ufuncs_cxx',
+ # sources=ufuncs_cxx_src,
+ # depends=ufuncs_cxx_dep,
+ # include_dirs=[curdir],
+ # define_macros=define_macros,
+ # extra_info=get_info("npymath"))
+
+ #cfg = dict(get_system_info('lapack_opt'))
+ #config.add_extension('_ellip_harm_2',
+ # sources=['_ellip_harm_2.c', 'sf_error.c',],
+ # **cfg
+ # )
config.add_data_files('tests/*.py')
config.add_data_files('tests/data/README')
commit 055d7fcf48996f9619ddd68f4ac0ccb611e8706d
Author: Roman Yurchak <rth.yurchak@pm.me>
Date: Mon Oct 15 15:40:48 2018 +0200
Use dummy_threading
diff --git a/scipy/interpolate/tests/test_gil.py b/scipy/interpolate/tests/test_gil.py
index df3ab3bc4..974b68ada 100644
--- a/scipy/interpolate/tests/test_gil.py
+++ b/scipy/interpolate/tests/test_gil.py
@@ -1,7 +1,7 @@
from __future__ import division, print_function, absolute_import
import itertools
-import threading
+import dummy_threading as threading
import time
import numpy as np
diff --git a/scipy/ndimage/tests/test_filters.py b/scipy/ndimage/tests/test_filters.py
index 8c56393a6..8ff85547c 100644
--- a/scipy/ndimage/tests/test_filters.py
+++ b/scipy/ndimage/tests/test_filters.py
@@ -129,7 +129,7 @@ def test_gaussian_truncate():
class TestThreading(TestCase):
def check_func_thread(self, n, fun, args, out):
- from threading import Thread
+ from dummy_threading import Thread
thrds = [Thread(target=fun, args=args, kwargs={'output': out[x]}) for x in range(n)]
[t.start() for t in thrds]
[t.join() for t in thrds]
diff --git a/scipy/signal/signaltools.py b/scipy/signal/signaltools.py
index df7107684..2b9a18422 100644
--- a/scipy/signal/signaltools.py
+++ b/scipy/signal/signaltools.py
@@ -4,7 +4,7 @@
from __future__ import division, print_function, absolute_import
import warnings
-import threading
+import dummy_threading as threading
from . import sigtools
from scipy._lib.six import callable
diff --git a/scipy/sparse/tests/test_sparsetools.py b/scipy/sparse/tests/test_sparsetools.py
index 7a3c903cc..cc495d500 100644
--- a/scipy/sparse/tests/test_sparsetools.py
+++ b/scipy/sparse/tests/test_sparsetools.py
@@ -4,7 +4,7 @@ import sys
import os
import gc
import re
-import threading
+import dummy_threading as threading
from nose import SkipTest
import numpy as np
diff --git a/scipy/spatial/ckdtree.pyx b/scipy/spatial/ckdtree.pyx
index 2f98613a7..c9f657cf3 100644
--- a/scipy/spatial/ckdtree.pyx
+++ b/scipy/spatial/ckdtree.pyx
@@ -17,8 +17,7 @@ from libc.string cimport memset, memcpy
cimport cython
-from multiprocessing import cpu_count
-import threading
+import dummy_threading as threading
cdef extern from "limits.h":
long LONG_MAX
@@ -26,7 +25,7 @@ cdef extern from "limits.h":
cdef extern from "ckdtree_methods.h":
int number_of_processors
-number_of_processors = cpu_count()
+number_of_processors = 1
from libcpp.vector cimport vector
from libc cimport string
@@ -91,7 +90,7 @@ cdef extern from "cpp_utils.h":
# coo_entry wrapper
# =================
-cdef class coo_entries:
+cdef class coo_entries(object):
cdef:
readonly object __array_interface__
diff --git a/scipy/spatial/qhull.pyx b/scipy/spatial/qhull.pyx
index ba33fadbe..644a57eaf 100644
--- a/scipy/spatial/qhull.pyx
+++ b/scipy/spatial/qhull.pyx
@@ -10,7 +10,7 @@ Wrappers for Qhull triangulation, plus some additional N-D geometry utilities
# Distributed under the same BSD license as Scipy.
#
-import threading
+import dummy_threading as threading
import numpy as np
cimport numpy as np
cimport cython
diff --git a/scipy/special/_ellip_harm.py b/scipy/special/_ellip_harm.py
index 6972c2ad1..76a828201 100644
--- a/scipy/special/_ellip_harm.py
+++ b/scipy/special/_ellip_harm.py
@@ -1,6 +1,6 @@
from __future__ import division, print_function, absolute_import
-import threading
+import dummy_threadng as threading
import numpy as np
from ._ufuncs import _ellip_harm
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 = {
......@@ -10,22 +10,25 @@ sys.path.append(str(Path(__file__).parents[1]))
from pyodide_build.common import HOSTPYTHON # noqa: E402
def test_scipy_import(selenium_standalone):
def test_scipy_import(selenium_standalone, request):
from selenium.common.exceptions import JavascriptException
selenium = selenium_standalone
if selenium.browser == 'chrome':
request.applymarker(pytest.mark.xfail(
run=False, reason='chrome not supported'))
selenium.load_package("scipy")
selenium.run("""
import scipy
""")
# supported modules
for module in ['constants', 'fftpack', 'odr']:
for module in ['constants', 'fftpack', 'odr', 'sparse']:
selenium.run(f"import scipy.{module}")
# not yet built modules
for module in ['cluster', # needs sparse
'spatial', # needs sparse
'sparse',
'integrate', # needs special
'interpolate', # needs linalg
'linalg',
......
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