From 862f25742316eedd633c9985be1c63a6bfab9b1a Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Mon, 15 Oct 2018 16:36:06 +0200 Subject: [PATCH] Use dummy threading + re-enable C++ files that failed due to a gloabl namespace --- .gitignore | 1 + packages/scipy/meta.yaml | 3 +- ...e_modules_global_cpp_namespace_issue.patch | 93 ----- .../patches/disable_modules_with_blas.patch | 365 +++++++++--------- packages/scipy/patches/dummy_threading.patch | 115 ++++++ .../scipy/patches/skip-blas-imports.patch | 104 +++++ test/test_scipy.py | 9 +- 7 files changed, 421 insertions(+), 269 deletions(-) delete mode 100644 packages/scipy/patches/disable_modules_global_cpp_namespace_issue.patch create mode 100644 packages/scipy/patches/dummy_threading.patch create mode 100644 packages/scipy/patches/skip-blas-imports.patch diff --git a/.gitignore b/.gitignore index 3b6c025a2..d8082feea 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ .pytest_cache/ __pycache__ geckodriver.log +firefox/ build downloads diff --git a/packages/scipy/meta.yaml b/packages/scipy/meta.yaml index 3e0270109..e1be39b8a 100644 --- a/packages/scipy/meta.yaml +++ b/packages/scipy/meta.yaml @@ -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 diff --git a/packages/scipy/patches/disable_modules_global_cpp_namespace_issue.patch b/packages/scipy/patches/disable_modules_global_cpp_namespace_issue.patch deleted file mode 100644 index 49722d313..000000000 --- a/packages/scipy/patches/disable_modules_global_cpp_namespace_issue.patch +++ /dev/null @@ -1,93 +0,0 @@ -commit 0da8a50bd566ee7810ed1888112cc9c9a1b27d9e -Author: Roman Yurchak -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') diff --git a/packages/scipy/patches/disable_modules_with_blas.patch b/packages/scipy/patches/disable_modules_with_blas.patch index 8bfacb0e2..d6fe7cd89 100644 --- a/packages/scipy/patches/disable_modules_with_blas.patch +++ b/packages/scipy/patches/disable_modules_with_blas.patch @@ -1,53 +1,68 @@ -commit 96142c968cda5394482c9fe086d0eeaf88d8e4f4 +commit 5c2a77219d5bd92c48d8d5d5e71ba28228c282a1 Author: Roman Yurchak Date: Mon Oct 8 10:53:11 2018 +0200 Removes files that require LAPACK +diff --git a/scipy/linalg/__init__.py b/scipy/linalg/__init__.py +index fd02851bf..faa6723d2 100644 +--- a/scipy/linalg/__init__.py ++++ b/scipy/linalg/__init__.py +@@ -181,13 +181,16 @@ from ._decomp_qz import * + from .decomp_svd import * + from .decomp_schur import * + from ._decomp_polar import * +-from .matfuncs import * +-from .blas import * +-from .lapack import * +-from .special_matrices import * +-from ._solvers import * +-from ._procrustes import * +-from ._decomp_update import * ++try: ++ from .matfuncs import * ++ from .blas import * ++ from .lapack import * ++ from .special_matrices import * ++ from ._solvers import * ++ from ._procrustes import * ++ from ._decomp_update import * ++except ImportError: ++ pass + + __all__ = [s for s in dir() if not s.startswith('_')] + diff --git a/scipy/linalg/setup.py b/scipy/linalg/setup.py -deleted file mode 100755 -index 2c9b9ba22..000000000 +index 2c9b9ba22..035b4bb80 100755 --- a/scipy/linalg/setup.py -+++ /dev/null -@@ -1,173 +0,0 @@ --#!/usr/bin/env python --from __future__ import division, print_function, absolute_import -- --import os --from os.path import join -- -- --def configuration(parent_package='', top_path=None): -- from distutils.sysconfig import get_python_inc -- from numpy.distutils.system_info import get_info, NotFoundError, numpy_info -- from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs -- from scipy._build_utils import (get_sgemv_fix, get_g77_abi_wrappers, -- split_fortran_files) -- -- config = Configuration('linalg', parent_package, top_path) -- -- lapack_opt = get_info('lapack_opt') -- ++++ b/scipy/linalg/setup.py +@@ -16,8 +16,8 @@ def configuration(parent_package='', top_path=None): + + lapack_opt = get_info('lapack_opt') + - if not lapack_opt: - raise NotFoundError('no lapack/blas resources found') -- -- atlas_version = ([v[3:-3] for k, v in lapack_opt.get('define_macros', []) -- if k == 'ATLAS_INFO']+[None])[0] -- if atlas_version: -- print(('ATLAS version: %s' % atlas_version)) -- -- # fblas: -- sources = ['fblas.pyf.src'] -- sources += get_g77_abi_wrappers(lapack_opt) -- sources += get_sgemv_fix(lapack_opt) -- ++ # if not lapack_opt: ++ # raise NotFoundError('no lapack/blas resources found') + + atlas_version = ([v[3:-3] for k, v in lapack_opt.get('define_macros', []) + if k == 'ATLAS_INFO']+[None])[0] +@@ -29,45 +29,45 @@ def configuration(parent_package='', top_path=None): + sources += get_g77_abi_wrappers(lapack_opt) + sources += get_sgemv_fix(lapack_opt) + - config.add_extension('_fblas', - sources=sources, - depends=['fblas_l?.pyf.src'], - extra_info=lapack_opt - ) -- -- # flapack: ++ #config.add_extension('_fblas', ++ # sources=sources, ++ # depends=['fblas_l?.pyf.src'], ++ # extra_info=lapack_opt ++ # ) + + # flapack: - sources = ['flapack.pyf.src'] - sources += get_g77_abi_wrappers(lapack_opt) - dep_pfx = join('src', 'lapack_deprecations') @@ -80,75 +95,68 @@ index 2c9b9ba22..000000000 - sources=[join('src', 'det.f'), join('src', 'lu.f')], - extra_info=lapack_opt - ) -- -- # _interpolative: -- routines_to_split = [ -- 'dfftb1', -- 'dfftf1', -- 'dffti1', -- 'dsint1', -- 'dzfft1', -- 'id_srand', -- 'idd_copyints', -- 'idd_id2svd0', -- 'idd_pairsamps', -- 'idd_permute', -- 'idd_permuter', -- 'idd_random_transf0', -- 'idd_random_transf0_inv', -- 'idd_random_transf_init0', -- 'idd_subselect', -- 'iddp_asvd0', -- 'iddp_rsvd0', -- 'iddr_asvd0', -- 'iddr_rsvd0', -- 'idz_estrank0', -- 'idz_id2svd0', -- 'idz_permute', -- 'idz_permuter', -- 'idz_random_transf0_inv', -- 'idz_random_transf_init0', -- 'idz_random_transf_init00', -- 'idz_realcomp', -- 'idz_realcomplex', -- 'idz_reco', -- 'idz_subselect', -- 'idzp_aid0', -- 'idzp_aid1', -- 'idzp_asvd0', -- 'idzp_rsvd0', -- 'idzr_asvd0', -- 'idzr_reco', -- 'idzr_rsvd0', -- 'zfftb1', -- 'zfftf1', -- 'zffti1', -- ] -- print('Splitting linalg.interpolative Fortran source files') -- dirname = os.path.split(os.path.abspath(__file__))[0] -- fnames = split_fortran_files(join(dirname, 'src', 'id_dist', 'src'), -- routines_to_split) ++ #sources = ['flapack.pyf.src'] ++ #sources += get_g77_abi_wrappers(lapack_opt) ++ #dep_pfx = join('src', 'lapack_deprecations') ++ #deprecated_lapack_routines = [join(dep_pfx, c + 'gegv.f') for c in 'cdsz'] ++ #sources += deprecated_lapack_routines ++ ++ #config.add_extension('_flapack', ++ # sources=sources, ++ # depends=['flapack_user.pyf.src'], ++ # extra_info=lapack_opt ++ # ) ++ ++ #if atlas_version is not None: ++ # # cblas: ++ # config.add_extension('_cblas', ++ # sources=['cblas.pyf.src'], ++ # depends=['cblas.pyf.src', 'cblas_l1.pyf.src'], ++ # extra_info=lapack_opt ++ # ) ++ ++ # # clapack: ++ # config.add_extension('_clapack', ++ # sources=['clapack.pyf.src'], ++ # depends=['clapack.pyf.src'], ++ # extra_info=lapack_opt ++ # ) ++ ++ ## _flinalg: ++ #config.add_extension('_flinalg', ++ # sources=[join('src', 'det.f'), join('src', 'lu.f')], ++ # extra_info=lapack_opt ++ # ) + + # _interpolative: + routines_to_split = [ +@@ -116,15 +116,15 @@ def configuration(parent_package='', top_path=None): + dirname = os.path.split(os.path.abspath(__file__))[0] + fnames = split_fortran_files(join(dirname, 'src', 'id_dist', 'src'), + routines_to_split) - fnames = [join('src', 'id_dist', 'src', f) for f in fnames] - config.add_extension('_interpolative', fnames + ["interpolative.pyf"], - extra_info=lapack_opt - ) -- -- # _calc_lwork: ++ #fnames = [join('src', 'id_dist', 'src', f) for f in fnames] ++ #config.add_extension('_interpolative', fnames + ["interpolative.pyf"], ++ # extra_info=lapack_opt ++ # ) + + # _calc_lwork: - config.add_extension('_calc_lwork', - [join('src', 'calc_lwork.f')], - extra_info=lapack_opt) -- -- # _solve_toeplitz: -- config.add_extension('_solve_toeplitz', -- sources=[('_solve_toeplitz.c')], -- include_dirs=[get_numpy_include_dirs()]) -- -- config.add_data_dir('tests') -- -- # Cython BLAS/LAPACK -- config.add_data_files('cython_blas.pxd') -- config.add_data_files('cython_lapack.pxd') -- ++ #config.add_extension('_calc_lwork', ++ # [join('src', 'calc_lwork.f')], ++ # extra_info=lapack_opt) + + # _solve_toeplitz: + config.add_extension('_solve_toeplitz', +@@ -137,27 +137,27 @@ def configuration(parent_package='', top_path=None): + config.add_data_files('cython_blas.pxd') + config.add_data_files('cython_lapack.pxd') + - sources = ['_blas_subroutine_wrappers.f', '_lapack_subroutine_wrappers.f'] - sources += get_g77_abi_wrappers(lapack_opt) - sources += get_sgemv_fix(lapack_opt) @@ -170,54 +178,60 @@ index 2c9b9ba22..000000000 - include_dirs=['.'], - libraries=['fwrappers'], - extra_info=lapack_opt) -- -- config.add_extension('_decomp_update', -- sources=['_decomp_update.c']) -- -- return config -- -- --if __name__ == '__main__': -- from numpy.distutils.core import setup -- from linalg_version import linalg_version -- -- setup(version=linalg_version, -- **configuration(top_path='').todict()) ++ #sources = ['_blas_subroutine_wrappers.f', '_lapack_subroutine_wrappers.f'] ++ #sources += get_g77_abi_wrappers(lapack_opt) ++ #sources += get_sgemv_fix(lapack_opt) ++ #includes = numpy_info().get_include_dirs() + [get_python_inc()] ++ #config.add_library('fwrappers', sources=sources, include_dirs=includes) ++ ++ #config.add_extension('cython_blas', ++ # sources=['cython_blas.c'], ++ # depends=['cython_blas.pyx', 'cython_blas.pxd', ++ # 'fortran_defs.h', '_blas_subroutines.h'], ++ # include_dirs=['.'], ++ # libraries=['fwrappers'], ++ # extra_info=lapack_opt) ++ ++ #config.add_extension('cython_lapack', ++ # sources=['cython_lapack.c'], ++ # depends=['cython_lapack.pyx', 'cython_lapack.pxd', ++ # 'fortran_defs.h', '_lapack_subroutines.h'], ++ # include_dirs=['.'], ++ # libraries=['fwrappers'], ++ # extra_info=lapack_opt) + + config.add_extension('_decomp_update', + sources=['_decomp_update.c']) diff --git a/scipy/sparse/linalg/eigen/arpack/setup.py b/scipy/sparse/linalg/eigen/arpack/setup.py -deleted file mode 100755 -index a8175a9d5..000000000 +index a8175a9d5..c63b76dda 100755 --- a/scipy/sparse/linalg/eigen/arpack/setup.py -+++ /dev/null -@@ -1,44 +0,0 @@ --#!/usr/bin/env python --from __future__ import division, print_function, absolute_import -- --from os.path import join -- -- --def configuration(parent_package='',top_path=None): -- from numpy.distutils.system_info import get_info, NotFoundError -- from numpy.distutils.misc_util import Configuration -- from scipy._build_utils import get_g77_abi_wrappers, get_sgemv_fix -- -- config = Configuration('arpack',parent_package,top_path) -- -- lapack_opt = get_info('lapack_opt') -- ++++ b/scipy/sparse/linalg/eigen/arpack/setup.py +@@ -13,28 +13,28 @@ def configuration(parent_package='',top_path=None): + + lapack_opt = get_info('lapack_opt') + - if not lapack_opt: - raise NotFoundError('no lapack/blas resources found') -- -- config = Configuration('arpack', parent_package, top_path) -- ++ #if not lapack_opt: ++ # raise NotFoundError('no lapack/blas resources found') + + config = Configuration('arpack', parent_package, top_path) + - arpack_sources = [join('ARPACK','SRC', '*.f')] - arpack_sources.extend([join('ARPACK','UTIL', '*.f')]) - arpack_sources.extend([join('ARPACK','LAPACK', '*.f')]) -- ++ #arpack_sources = [join('ARPACK','SRC', '*.f')] ++ #arpack_sources.extend([join('ARPACK','UTIL', '*.f')]) ++ #arpack_sources.extend([join('ARPACK','LAPACK', '*.f')]) + - arpack_sources += get_g77_abi_wrappers(lapack_opt) -- ++ #arpack_sources += get_g77_abi_wrappers(lapack_opt) + - config.add_library('arpack_scipy', sources=arpack_sources, - include_dirs=[join('ARPACK', 'SRC')]) -- ++ #config.add_library('arpack_scipy', sources=arpack_sources, ++ # include_dirs=[join('ARPACK', 'SRC')]) + - ext_sources = ['arpack.pyf.src'] - ext_sources += get_sgemv_fix(lapack_opt) - config.add_extension('_arpack', @@ -226,34 +240,25 @@ index a8175a9d5..000000000 - extra_info=lapack_opt, - depends=arpack_sources, - ) -- -- config.add_data_dir('tests') -- return config -- --if __name__ == '__main__': -- from numpy.distutils.core import setup -- setup(**configuration(top_path='').todict()) ++ #ext_sources = ['arpack.pyf.src'] ++ #ext_sources += get_sgemv_fix(lapack_opt) ++ #config.add_extension('_arpack', ++ # sources=ext_sources, ++ # libraries=['arpack_scipy'], ++ # extra_info=lapack_opt, ++ # depends=arpack_sources, ++ # ) + + config.add_data_dir('tests') + return config diff --git a/scipy/sparse/linalg/isolve/setup.py b/scipy/sparse/linalg/isolve/setup.py -deleted file mode 100755 -index becb9237a..000000000 +index becb9237a..17288207e 100755 --- a/scipy/sparse/linalg/isolve/setup.py -+++ /dev/null -@@ -1,48 +0,0 @@ --#!/usr/bin/env python --from __future__ import division, print_function, absolute_import -- --from os.path import join -- -- --def configuration(parent_package='',top_path=None): -- from numpy.distutils.system_info import get_info, NotFoundError -- from numpy.distutils.misc_util import Configuration -- from scipy._build_utils import get_g77_abi_wrappers -- -- config = Configuration('isolve',parent_package,top_path) -- -- lapack_opt = get_info('lapack_opt') -- ++++ b/scipy/sparse/linalg/isolve/setup.py +@@ -13,29 +13,29 @@ def configuration(parent_package='',top_path=None): + + lapack_opt = get_info('lapack_opt') + - if not lapack_opt: - raise NotFoundError('no lapack/blas resources found') - @@ -277,13 +282,29 @@ index becb9237a..000000000 - config.add_extension('_iterative', - sources=sources, - extra_info=lapack_opt) -- -- config.add_data_dir('tests') -- -- return config -- -- --if __name__ == '__main__': -- from numpy.distutils.core import setup -- -- setup(**configuration(top_path='').todict()) ++ #if not lapack_opt: ++ # raise NotFoundError('no lapack/blas resources found') ++ ++ ## iterative methods ++ #methods = ['BiCGREVCOM.f.src', ++ # 'BiCGSTABREVCOM.f.src', ++ # 'CGREVCOM.f.src', ++ # 'CGSREVCOM.f.src', ++# # 'ChebyREVCOM.f.src', ++ # 'GMRESREVCOM.f.src', ++# # 'JacobiREVCOM.f.src', ++ # 'QMRREVCOM.f.src', ++# # 'SORREVCOM.f.src' ++ # ] ++ ++ #Util = ['STOPTEST2.f.src','getbreak.f.src'] ++ #sources = Util + methods + ['_iterative.pyf.src'] ++ #sources = [join('iterative', x) for x in sources] ++ #sources += get_g77_abi_wrappers(lapack_opt) ++ ++ #config.add_extension('_iterative', ++ # sources=sources, ++ # extra_info=lapack_opt) + + config.add_data_dir('tests') + diff --git a/packages/scipy/patches/dummy_threading.patch b/packages/scipy/patches/dummy_threading.patch new file mode 100644 index 000000000..1dfccf11c --- /dev/null +++ b/packages/scipy/patches/dummy_threading.patch @@ -0,0 +1,115 @@ +commit 055d7fcf48996f9619ddd68f4ac0ccb611e8706d +Author: Roman Yurchak +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 diff --git a/packages/scipy/patches/skip-blas-imports.patch b/packages/scipy/patches/skip-blas-imports.patch new file mode 100644 index 000000000..d14a03eac --- /dev/null +++ b/packages/scipy/patches/skip-blas-imports.patch @@ -0,0 +1,104 @@ +commit 3f9694b956a2c900f92b635e28ea0eed4baed2fa +Author: Roman Yurchak +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 = { diff --git a/test/test_scipy.py b/test/test_scipy.py index da1467da7..6cc3395cb 100644 --- a/test/test_scipy.py +++ b/test/test_scipy.py @@ -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',