Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
04603d53
Commit
04603d53
authored
Dec 03, 2018
by
Michael Droettboom
Committed by
GitHub
Dec 03, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #211 from rth/scipy
Scipy packaging
parents
c78a430a
defc24c4
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
746 additions
and
23 deletions
+746
-23
.circleci/config.yml
.circleci/config.yml
+1
-1
.gitignore
.gitignore
+1
-0
CLAPACK/Makefile
CLAPACK/Makefile
+0
-1
CLAPACK/Makefile.envs
CLAPACK/Makefile.envs
+2
-2
Makefile
Makefile
+2
-2
benchmark/benchmark.py
benchmark/benchmark.py
+1
-1
emsdk/patches/num_params.patch
emsdk/patches/num_params.patch
+1
-1
packages/Makefile
packages/Makefile
+4
-1
packages/scipy/meta.yaml
packages/scipy/meta.yaml
+49
-0
packages/scipy/patches/disable_scipy_stats_mvn.patch
packages/scipy/patches/disable_scipy_stats_mvn.patch
+39
-0
packages/scipy/patches/dummy_threading.patch
packages/scipy/patches/dummy_threading.patch
+115
-0
packages/scipy/patches/fix-blas.patch
packages/scipy/patches/fix-blas.patch
+89
-0
packages/scipy/patches/fix-build-gcc5-a80460.patch
packages/scipy/patches/fix-build-gcc5-a80460.patch
+54
-0
packages/scipy/patches/fix_mmap.patch
packages/scipy/patches/fix_mmap.patch
+27
-0
packages/scipy/patches/force_malloc.patch
packages/scipy/patches/force_malloc.patch
+94
-0
packages/scipy/patches/skip-fortran-fails-to-link.patch
packages/scipy/patches/skip-fortran-fails-to-link.patch
+125
-0
packages/scipy/patches/skip_ellip_harm_2_pyx_ctypes.patch
packages/scipy/patches/skip_ellip_harm_2_pyx_ctypes.patch
+60
-0
pyodide_build/buildpkg.py
pyodide_build/buildpkg.py
+1
-1
pyodide_build/pywasmcross.py
pyodide_build/pywasmcross.py
+36
-4
run_docker
run_docker
+1
-1
test/conftest.py
test/conftest.py
+4
-4
test/packages/test_scipy.py
test/packages/test_scipy.py
+31
-0
test/test_common.py
test/test_common.py
+7
-2
test/test_python.py
test/test_python.py
+2
-2
No files found.
.circleci/config.yml
View file @
04603d53
...
@@ -3,7 +3,7 @@ version: 2
...
@@ -3,7 +3,7 @@ version: 2
defaults
:
&defaults
defaults
:
&defaults
working_directory
:
~/repo
working_directory
:
~/repo
docker
:
docker
:
-
image
:
iodide/pyodide-env:0.3.
0
-
image
:
iodide/pyodide-env:0.3.
1
jobs
:
jobs
:
build
:
build
:
...
...
.gitignore
View file @
04603d53
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
.pytest_cache/
.pytest_cache/
__pycache__
__pycache__
geckodriver.log
geckodriver.log
firefox/
build
build
downloads
downloads
...
...
CLAPACK/Makefile
View file @
04603d53
...
@@ -25,7 +25,6 @@ $(SRC)/lapack_WA.bc: $(SRC)/Makefile
...
@@ -25,7 +25,6 @@ $(SRC)/lapack_WA.bc: $(SRC)/Makefile
$(SRC)/Makefile
:
$(SRC)/Makefile
:
wget
-q
-O
clapack.tgz http://www.netlib.org/clapack/clapack.tgz
wget
-q
-O
clapack.tgz http://www.netlib.org/clapack/clapack.tgz
md5sum
--quiet
--check
checksums
||
(
rm
-f
clapack.tgz
;
false
)
md5sum
--quiet
--check
checksums
||
(
rm
-f
clapack.tgz
;
false
)
tar
xzf clapack.tgz
tar
xzf clapack.tgz
rm
-rf
$(SRC)
rm
-rf
$(SRC)
mv
CLAPACK-
$(CLAPACK_VERSION)
$(SRC)
mv
CLAPACK-
$(CLAPACK_VERSION)
$(SRC)
...
...
CLAPACK/Makefile.envs
View file @
04603d53
CFLAGS_OPT
=
-O
2
CFLAGS_OPT
=
-O
s
-s
INLINING_LIMIT
=
5
LDFLAGS_OPT
=
-O
2
LDFLAGS_OPT
=
-O
s
-s
INLINING_LIMIT
=
5
Makefile
View file @
04603d53
...
@@ -15,6 +15,7 @@ OPTFLAGS=-O3
...
@@ -15,6 +15,7 @@ OPTFLAGS=-O3
CFLAGS
=
$(OPTFLAGS)
-g
-I
$(PYTHONINCLUDE)
-Wno-warn-absolute-paths
CFLAGS
=
$(OPTFLAGS)
-g
-I
$(PYTHONINCLUDE)
-Wno-warn-absolute-paths
CXXFLAGS
=
$(CFLAGS)
-std
=
c++14
CXXFLAGS
=
$(CFLAGS)
-std
=
c++14
# __ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv is in
# __ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv is in
# EXPORTED_FUNCTIONS to keep the C++ standard library in the core, even though
# EXPORTED_FUNCTIONS to keep the C++ standard library in the core, even though
# there isn't any C++ there, for the sake of loading dynamic modules written in
# there isn't any C++ there, for the sake of loading dynamic modules written in
...
@@ -134,7 +135,7 @@ clean:
...
@@ -134,7 +135,7 @@ clean:
rm
-fr
src/
*
.bc
rm
-fr
src/
*
.bc
make
-C
packages clean
make
-C
packages clean
make
-C
six clean
make
-C
six clean
echo
"The Emsdk
and CPython
are not cleaned. cd into those directories to do so."
echo
"The Emsdk
, CPython and CLAPACK
are not cleaned. cd into those directories to do so."
%.bc
:
%.c $(CPYTHONLIB) $(LZ4LIB)
%.bc
:
%.c $(CPYTHONLIB) $(LZ4LIB)
...
@@ -216,6 +217,5 @@ $(CLAPACK): $(CPYTHONLIB)
...
@@ -216,6 +217,5 @@ $(CLAPACK): $(CPYTHONLIB)
build/packages.json
:
$(CPYTHONLIB) $(CLAPACK)
build/packages.json
:
$(CPYTHONLIB) $(CLAPACK)
make
-C
packages
make
-C
packages
emsdk/emsdk/.complete
:
emsdk/emsdk/.complete
:
make
-C
emsdk
make
-C
emsdk
benchmark/benchmark.py
View file @
04603d53
...
@@ -68,7 +68,7 @@ def parse_numpy_benchmark(filename):
...
@@ -68,7 +68,7 @@ def parse_numpy_benchmark(filename):
lines
=
[]
lines
=
[]
with
open
(
filename
)
as
fp
:
with
open
(
filename
)
as
fp
:
for
line
in
fp
:
for
line
in
fp
:
m
=
re
.
match
(
'^#
\
s*(se
t
up|run): (.*)$'
,
line
)
m
=
re
.
match
(
r
'^#\
s*(se
tup|run): (.*)$'
,
line
)
if
m
:
if
m
:
line
=
'{} = {!r}
\
n
'
.
format
(
m
.
group
(
1
),
m
.
group
(
2
))
line
=
'{} = {!r}
\
n
'
.
format
(
m
.
group
(
1
),
m
.
group
(
2
))
lines
.
append
(
line
)
lines
.
append
(
line
)
...
...
emsdk/patches/num_params.patch
View file @
04603d53
...
@@ -7,7 +7,7 @@ index 013e9403..d95fc282 100644
...
@@ -7,7 +7,7 @@ index 013e9403..d95fc282 100644
// to match when dynamically linking, and also dynamic linking is why we
// to match when dynamically linking, and also dynamic linking is why we
// can't just detect this automatically in the module we see.)
// can't just detect this automatically in the module we see.)
-static const int NUM_PARAMS = 15;
-static const int NUM_PARAMS = 15;
+static const int NUM_PARAMS =
32;
+static const int NUM_PARAMS =
61; // needed by scipy.odr._odrpack
// Converts a value to the ABI type of i64.
// Converts a value to the ABI type of i64.
static Expression* toABI(Expression* value, Module* module) {
static Expression* toABI(Expression* value, Module* module) {
packages/Makefile
View file @
04603d53
PYODIDE_ROOT
=
$(
abspath
..
)
PYODIDE_ROOT
=
$(
abspath
..
)
include
../Makefile.envs
include
../Makefile.envs
all
:
all
:
deps
../bin/pyodide buildall
.
../build
\
../bin/pyodide buildall
.
../build
\
--ldflags
=
"
$(SIDE_LDFLAGS)
"
--host
=
$(HOSTPYTHONROOT)
--target
=
$(TARGETPYTHONROOT)
--ldflags
=
"
$(SIDE_LDFLAGS)
"
--host
=
$(HOSTPYTHONROOT)
--target
=
$(TARGETPYTHONROOT)
deps
:
# Install build dependencies
$(HOSTPYTHON)
-m
pip
install
Cython Tempita
clean
:
clean
:
rm
-rf
./
*
/build
rm
-rf
./
*
/build
packages/scipy/meta.yaml
0 → 100644
View file @
04603d53
package
:
name
:
scipy
version
:
0.17.1
source
:
# We can't use the version from PyPi as it includes Cythonized files
# generated with an older Cython that does not support Python 3.7
# This requires,
# pip install Cython Tempita
# on the host for the build
url
:
https://github.com/scipy/scipy/archive/v0.17.1.tar.gz
sha256
:
bf22383d9e2526ffdc53a6c7d3d66dab45a86291ed35d8e281bd1a5d2c34187b
patches
:
# these patches can be found as commits in
# https://github.com/rth/scipy/tree/0.17.1-pyodide
# on top of the v0.17.1 tag
-
patches/fix-blas.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_ellip_harm_2_pyx_ctypes.patch
-
patches/fix_mmap.patch
build
:
cflags
:
-I../../../../CLAPACK/CLAPACK-WA/INCLUDE -Wno-implicit-function-declaration
cxxflags
:
requirements
:
run
:
-
numpy
test
:
imports
:
-
scipy
-
scipy.cluster
-
scipy.constants
-
scipy.fftpack
-
scipy.odr
-
scipy.sparse
-
scipy.interpolate
-
scipy.integrate
-
scipy.linalg
-
scipy.misc
-
scipy.ndimage
-
scipy.spatial
-
scipy.special
packages/scipy/patches/disable_scipy_stats_mvn.patch
0 → 100644
View file @
04603d53
commit d6740caa7400105a578ace74f8c25bbb3434178c
Author: Roman Yurchak <rth.yurchak@pm.me>
Date: Wed Oct 10 14:47:12 2018 +0200
Disable scipy.stats.mvn
diff --git a/scipy/stats/kde.py b/scipy/stats/kde.py
index 7c702a038..8b0ab0254 100644
--- a/scipy/stats/kde.py
+++ b/scipy/stats/kde.py
@@ -32,7 +32,10 @@
import numpy as np
from numpy.random import randint, multivariate_normal
# Local imports.
-from . import mvn
+try:
+ from . import mvn
+except ImportError:
+ mvn = None
__all__ = ['gaussian_kde']
diff --git a/scipy/stats/setup.py b/scipy/stats/setup.py
index f1a02df4e..7366ec12d 100755
--- a/scipy/stats/setup.py
+++ b/scipy/stats/setup.py
@@ -32,9 +32,9 @@
def configuration(parent_package='',top_path=None):
)
# add mvn module
- config.add_extension('mvn',
- sources=['mvn.pyf','mvndst.f'],
- )
+ #config.add_extension('mvn',
+ # sources=['mvn.pyf','mvndst.f'],
+ #)
return config
packages/scipy/patches/dummy_threading.patch
0 → 100644
View file @
04603d53
commit cfd6c4b18c5f338842d2ee509bfb2d3a3c6f6439
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 62e50655e..61e9949cc 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_threading as threading
import numpy as np
from ._ufuncs import _ellip_harm
packages/scipy/patches/fix-blas.patch
0 → 100644
View file @
04603d53
commit f03d85c00ae993c3c87a5a7b2ea0c1215f57ee04
Author: Roman Yurchak <rth.yurchak@pm.me>
Date: Mon Oct 8 10:53:11 2018 +0200
Partial fixes for BLAS/LAPACK
diff --git a/scipy/linalg/setup.py b/scipy/linalg/setup.py
index 2c9b9ba22..e8c7336d5 100755
--- a/scipy/linalg/setup.py
+++ b/scipy/linalg/setup.py
@@ -14,7 +14,13 @@
def configuration(parent_package='', top_path=None):
config = Configuration('linalg', parent_package, top_path)
- lapack_opt = get_info('lapack_opt')
+ lapack_opt = { # libraries will be auto-generated by pywasmcross
+ 'libraries': [],
+ 'include_dirs': [],
+ 'library_dirs': ['../../../../CLAPACK/CLAPACK-WA/'],
+ 'language': 'f77',
+ 'define_macros': [('NO_ATLAS_INFO', 1),
+ ('HAVE_CBLAS', None)]}
if not lapack_opt:
raise NotFoundError('no lapack/blas resources found')
@@ -117,9 +123,22 @@
def configuration(parent_package='', top_path=None):
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
- )
+ # TODO: The following fails with,
+ # scipy/linalg/src/id_dist/src/idd_sfft.c:114:22: error: conflicting types for 'idd_sffti1__'
+ # /* Subroutine */ int idd_sffti1__(integer *ind, integer *n, doublereal *wsave)
+ # ^
+ # scipy/linalg/src/id_dist/src/idd_sfft.c:72:33: note: previous declaration is here
+ # extern /* Subroutine */ int idd_sffti1__(integer *, integer *,
+ # ^
+ # scipy/linalg/src/id_dist/src/idd_sfft.c:371:22: error: conflicting types for 'idd_sfft1__'
+ # /* Subroutine */ int idd_sfft1__(integer *ind, integer *n, doublereal *v,
+ # ^
+ # scipy/linalg/src/id_dist/src/idd_sfft.c:311:33: note: previous declaration is here
+ # extern /* Subroutine */ int idd_sfft1__(integer *, integer *, doublereal *<Paste>
+ #
+ #config.add_extension('_interpolative', fnames + ["interpolative.pyf"],
+ # extra_info=lapack_opt
+ # )
# _calc_lwork:
config.add_extension('_calc_lwork',
diff --git a/scipy/sparse/linalg/eigen/arpack/setup.py b/scipy/sparse/linalg/eigen/arpack/setup.py
index a8175a9d5..88a717fe6 100755
--- a/scipy/sparse/linalg/eigen/arpack/setup.py
+++ b/scipy/sparse/linalg/eigen/arpack/setup.py
@@ -11,7 +11,13 @@
def configuration(parent_package='',top_path=None):
config = Configuration('arpack',parent_package,top_path)
- lapack_opt = get_info('lapack_opt')
+ lapack_opt = { # libraries will be auto-generated by pywasmcross
+ 'libraries': [],
+ 'include_dirs': [],
+ 'library_dirs': ['../../../../CLAPACK/CLAPACK-WA/'],
+ 'language': 'f77',
+ 'define_macros': [('NO_ATLAS_INFO', 1),
+ ('HAVE_CBLAS', None)]}
if not lapack_opt:
raise NotFoundError('no lapack/blas resources found')
diff --git a/scipy/sparse/linalg/isolve/setup.py b/scipy/sparse/linalg/isolve/setup.py
index becb9237a..707e3f49d 100755
--- a/scipy/sparse/linalg/isolve/setup.py
+++ b/scipy/sparse/linalg/isolve/setup.py
@@ -11,7 +11,13 @@
def configuration(parent_package='',top_path=None):
config = Configuration('isolve',parent_package,top_path)
- lapack_opt = get_info('lapack_opt')
+ lapack_opt = { # libraries will be auto-generated by pywasmcross
+ 'libraries': [],
+ 'include_dirs': [],
+ 'library_dirs': ['../../../../CLAPACK/CLAPACK-WA/'],
+ 'language': 'f77',
+ 'define_macros': [('NO_ATLAS_INFO', 1),
+ ('HAVE_CBLAS', None)]}
if not lapack_opt:
raise NotFoundError('no lapack/blas resources found')
packages/scipy/patches/fix-build-gcc5-a80460.patch
0 → 100644
View file @
04603d53
commit a80460f1b45035d34575866e6394107396ac62e2
Author: Michael Danilov <mike402@users.noreply.github.com>
Date: Thu Apr 20 18:08:39 2017 +0200
Fix build with GCC5.
diff --git a/scipy/odr/odrpack/d_lpkbls.f b/scipy/odr/odrpack/d_lpkbls.f
index 324b7a8a2..1e6624d63 100644
--- a/scipy/odr/odrpack/d_lpkbls.f
+++ b/scipy/odr/odrpack/d_lpkbls.f
@@ -136,8 +136,8 @@
C***FIRST EXECUTABLE STATEMENT DAXPY
IF(N.LE.0.OR.DA.EQ.0.D0) RETURN
- IF (INCX.EQ.INCY) IF(INCX.lt.1) GOTO 5
- IF (INCX.EQ.INCY) IF(INCX.eq.1) GOTO 20
+ IF (INCX.EQ.INCY .AND. INCX.lt.1) GOTO 5
+ IF (INCX.EQ.INCY .AND. INCX.eq.1) GOTO 20
GOTO 60
5 CONTINUE
@@ -483,8 +483,8 @@
C***FIRST EXECUTABLE STATEMENT DCOPY
IF(N.LE.0)RETURN
- IF (INCX.EQ.INCY) IF(INCX.lt.1) GOTO 5
- IF (INCX.EQ.INCY) IF(INCX.eq.1) GOTO 20
+ IF (INCX.EQ.INCY .AND. INCX.lt.1) GOTO 5
+ IF (INCX.EQ.INCY .AND. INCX.eq.1) GOTO 20
GOTO 60
5 CONTINUE
@@ -589,8 +589,8 @@
C***FIRST EXECUTABLE STATEMENT DDOT
DDOT = 0.D0
IF(N.LE.0)RETURN
- IF (INCX.EQ.INCY) IF(INCX.lt.1) GOTO 5
- IF (INCX.EQ.INCY) IF(INCX.eq.1) GOTO 20
+ IF (INCX.EQ.INCY .AND. INCX.lt.1) GOTO 5
+ IF (INCX.EQ.INCY .AND. INCX.eq.1) GOTO 20
GOTO 60
5 CONTINUE
@@ -1772,8 +1772,8 @@
C***FIRST EXECUTABLE STATEMENT DSWAP
IF(N.LE.0)RETURN
- IF (INCX.EQ.INCY) IF(INCX.lt.1) GOTO 5
- IF (INCX.EQ.INCY) IF(INCX.eq.1) GOTO 20
+ IF (INCX.EQ.INCY .AND. INCX.lt.1) GOTO 5
+ IF (INCX.EQ.INCY .AND. INCX.eq.1) GOTO 20
GOTO 60
5 CONTINUE
packages/scipy/patches/fix_mmap.patch
0 → 100644
View file @
04603d53
commit 6d4c53df9fecd236cb569b5f1997908af1daea6b
Author: Roman Yurchak <rth.yurchak@pm.me>
Date: Thu Oct 25 15:28:05 2018 +0200
Fix mmap imports
diff --git a/scipy/io/netcdf.py b/scipy/io/netcdf.py
index 841e97830..f06759015 100644
--- a/scipy/io/netcdf.py
+++ b/scipy/io/netcdf.py
@@ -39,7 +39,6 @@
__all__ = ['netcdf_file']
import warnings
import weakref
from operator import mul
-import mmap as mm
import numpy as np
from numpy.compat import asbytes, asstr
@@ -219,6 +218,8 @@
class netcdf_file(object):
def __init__(self, filename, mode='r', mmap=None, version=1,
maskandscale=False):
"""Initialize netcdf_file from fileobj (str or file-like)."""
+ import mmap as mm
+
if mode not in 'rwa':
raise ValueError("Mode must be either 'r', 'w' or 'a'.")
packages/scipy/patches/force_malloc.patch
0 → 100644
View file @
04603d53
commit 7a5b003922134abd01ae33b0a3e84d006673e9c6
Author: Roman Yurchak <rth.yurchak@pm.me>
Date: Mon Oct 8 12:13:55 2018 +0200
Workaround for malloc issues
This aims to avoid the "invalid call target: $_malloc" issues
- fixes scipy/optimize/zeros.c
- skips scipy/integrate/dop.pyf
- skips scipy/optimize/cobyla
diff --git a/scipy/integrate/setup.py b/scipy/integrate/setup.py
index 2be454c70..0545dc759 100755
--- a/scipy/integrate/setup.py
+++ b/scipy/integrate/setup.py
@@ -67,10 +67,10 @@
def configuration(parent_package='',top_path=None):
# **lapack_opt)
# dop
- config.add_extension('_dop',
- sources=['dop.pyf'],
- libraries=['dop'],
- depends=dop_src)
+ #config.add_extension('_dop',
+ # sources=['dop.pyf'],
+ # libraries=['dop'],
+ # depends=dop_src)
config.add_extension('_test_multivariate',
sources=quadpack_test_src)
diff --git a/scipy/optimize/__init__.py b/scipy/optimize/__init__.py
index 17ba78371..5deca7498 100644
--- a/scipy/optimize/__init__.py
+++ b/scipy/optimize/__init__.py
@@ -236,7 +236,7 @@
from .minpack import *
from .zeros import *
from .lbfgsb import fmin_l_bfgs_b, LbfgsInvHessProduct
from .tnc import fmin_tnc
-from .cobyla import fmin_cobyla
+#from .cobyla import fmin_cobyla
from .nonlin import *
from .slsqp import fmin_slsqp
from .nnls import nnls
diff --git a/scipy/optimize/_minimize.py b/scipy/optimize/_minimize.py
index 259546035..8b0b6960b 100644
--- a/scipy/optimize/_minimize.py
+++ b/scipy/optimize/_minimize.py
@@ -29,7 +29,8 @@
from ._trustregion_ncg import _minimize_trust_ncg
# constrained minimization
from .lbfgsb import _minimize_lbfgsb
from .tnc import _minimize_tnc
-from .cobyla import _minimize_cobyla
+#from .cobyla import _minimize_cobyla
+_minimize_cobyla = None
from .slsqp import _minimize_slsqp
diff --git a/scipy/optimize/setup.py b/scipy/optimize/setup.py
index 7d2b987cb..1861e7563 100755
--- a/scipy/optimize/setup.py
+++ b/scipy/optimize/setup.py
@@ -50,11 +50,11 @@
def configuration(parent_package='',top_path=None):
depends=[join('tnc','tnc.h')],
**numpy_nodepr_api)
- config.add_extension('_cobyla',
- sources=[join('cobyla',x) for x in ['cobyla.pyf',
- 'cobyla2.f',
- 'trstlp.f']],
- **numpy_nodepr_api)
+ #config.add_extension('_cobyla',
+ # sources=[join('cobyla',x) for x in ['cobyla.pyf',
+ # 'cobyla2.f',
+ # 'trstlp.f']],
+ # **numpy_nodepr_api)
sources = ['minpack2.pyf', 'dcsrch.f', 'dcstep.f']
config.add_extension('minpack2',
diff --git a/scipy/optimize/zeros.c b/scipy/optimize/zeros.c
index e557f37cb..d450b3ed4 100644
--- a/scipy/optimize/zeros.c
+++ b/scipy/optimize/zeros.c
@@ -193,6 +193,10 @@
PyObject *PyInit__zeros(void)
{
PyObject *m;
+ volatile long x;
+ x = (long)malloc(0);
+ free((void*)x);
+
m = PyModule_Create(&moduledef);
return m;
packages/scipy/patches/skip-fortran-fails-to-link.patch
0 → 100644
View file @
04603d53
commit c3affe05b5cb8d992cb7a955ff8b4c79452f3cc9
Author: Roman Yurchak <rth.yurchak@pm.me>
Date: Thu Oct 11 17:10:36 2018 +0200
Skip fortran code that fails to link
scipy.integrate.odepack
diff --git a/scipy/integrate/_ode.py b/scipy/integrate/_ode.py
index de1064048..52bf3875a 100644
--- a/scipy/integrate/_ode.py
+++ b/scipy/integrate/_ode.py
@@ -89,10 +89,19 @@
import re
import warnings
from numpy import asarray, array, zeros, int32, isscalar, real, imag, vstack
-
-from . import vode as _vode
-from . import _dop
-from . import lsoda as _lsoda
+try:
+ from . import vode as _vode
+except ImportError:
+ _vode = None
+try:
+ from . import _dop
+except ImportError:
+ _dop = None
+
+try:
+ from . import lsoda as _lsoda
+except ImportError:
+ _lsoda = None
#------------------------------------------------------------------------------
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
index 4725eb1c0..0545dc759 100755
--- a/scipy/integrate/setup.py
+++ b/scipy/integrate/setup.py
@@ -27,7 +27,7 @@
def configuration(parent_package='',top_path=None):
config.add_library('mach', sources=mach_src,
config_fc={'noopt':(__file__,1)})
config.add_library('quadpack', sources=quadpack_src)
- config.add_library('odepack', sources=odepack_src)
+ #config.add_library('odepack', sources=odepack_src)
config.add_library('dop', sources=dop_src)
# Extensions
@@ -44,27 +44,27 @@
def configuration(parent_package='',top_path=None):
odepack_opts = lapack_opt.copy()
odepack_opts.update(numpy_nodepr_api)
- config.add_extension('_odepack',
- sources=['_odepackmodule.c'],
- libraries=odepack_libs,
- depends=(odepack_src + mach_src),
- **odepack_opts)
+ #config.add_extension('_odepack',
+ # sources=['_odepackmodule.c'],
+ # libraries=odepack_libs,
+ # depends=(odepack_src + mach_src),
+ # **odepack_opts)
# vode
- config.add_extension('vode',
- sources=['vode.pyf'],
- libraries=odepack_libs,
- depends=(odepack_src
- + mach_src),
- **lapack_opt)
+ #config.add_extension('vode',
+ # sources=['vode.pyf'],
+ # libraries=odepack_libs,
+ # depends=(odepack_src
+ # + mach_src),
+ # **lapack_opt)
# lsoda
- config.add_extension('lsoda',
- sources=['lsoda.pyf'],
- libraries=odepack_libs,
- depends=(odepack_src
- + mach_src),
- **lapack_opt)
+ #config.add_extension('lsoda',
+ # sources=['lsoda.pyf'],
+ # libraries=odepack_libs,
+ # depends=(odepack_src
+ # + mach_src),
+ # **lapack_opt)
# dop
#config.add_extension('_dop',
@@ -76,11 +76,11 @@
def configuration(parent_package='',top_path=None):
sources=quadpack_test_src)
# Fortran+f2py extension module for testing odeint.
- config.add_extension('_test_odeint_banded',
- sources=odeint_banded_test_src,
- libraries=odepack_libs,
- depends=(odepack_src + mach_src),
- **lapack_opt)
+ #config.add_extension('_test_odeint_banded',
+ # sources=odeint_banded_test_src,
+ # libraries=odepack_libs,
+ # depends=(odepack_src + mach_src),
+ # **lapack_opt)
config.add_data_dir('tests')
return config
packages/scipy/patches/skip_ellip_harm_2_pyx_ctypes.patch
0 → 100644
View file @
04603d53
commit c72c210becd33a416cdc35467baf666ea3a9bb94
Author: Roman Yurchak <rth.yurchak@pm.me>
Date: Wed Oct 24 12:06:53 2018 +0200
Skip _ellip_harm_2.py due to ctypes
diff --git a/scipy/special/__init__.py b/scipy/special/__init__.py
index f013b818e..fb93f4238 100644
--- a/scipy/special/__init__.py
+++ b/scipy/special/__init__.py
@@ -631,7 +631,7 @@
from . import specfun
from . import orthogonal
from .orthogonal import *
from .spfun_stats import multigammaln
-from ._ellip_harm import ellip_harm, ellip_harm_2, ellip_normal
+from ._ellip_harm import ellip_harm, ellip_normal
from .lambertw import lambertw
diff --git a/scipy/special/_ellip_harm.py b/scipy/special/_ellip_harm.py
index 76a828201..fb5804178 100644
--- a/scipy/special/_ellip_harm.py
+++ b/scipy/special/_ellip_harm.py
@@ -4,7 +4,14 @@
import dummy_threadng as threading
import numpy as np
from ._ufuncs import _ellip_harm
-from ._ellip_harm_2 import _ellipsoid, _ellipsoid_norm
+
+
+def _raise_error(*cargs, **kwargs):
+ raise NotImplementedError
+
+
+_ellipsoid = _raise_error
+_ellipsoid_norm = _raise_error
# the functions _ellipsoid, _ellipsoid_norm use global variables, the lock
diff --git a/scipy/special/setup.py b/scipy/special/setup.py
index e5efb2e7a..c76ff5a6b 100755
--- a/scipy/special/setup.py
+++ b/scipy/special/setup.py
@@ -98,11 +98,11 @@
def configuration(parent_package='',top_path=None):
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
- )
+ #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')
pyodide_build/buildpkg.py
View file @
04603d53
...
@@ -154,7 +154,7 @@ def build_package(path, args):
...
@@ -154,7 +154,7 @@ def build_package(path, args):
os
.
chdir
(
dirpath
)
os
.
chdir
(
dirpath
)
try
:
try
:
buildpath
=
dirpath
/
'build'
buildpath
=
dirpath
/
'build'
if
not
buildpath
.
is_dir
():
if
not
buildpath
.
resolve
().
is_dir
():
os
.
makedirs
(
buildpath
)
os
.
makedirs
(
buildpath
)
srcpath
=
download_and_extract
(
buildpath
,
packagedir
,
pkg
,
args
)
srcpath
=
download_and_extract
(
buildpath
,
packagedir
,
pkg
,
args
)
patch
(
path
,
srcpath
,
pkg
,
args
)
patch
(
path
,
srcpath
,
pkg
,
args
)
...
...
pyodide_build/pywasmcross.py
View file @
04603d53
...
@@ -211,6 +211,8 @@ def handle_command(line, args, dryrun=False):
...
@@ -211,6 +211,8 @@ def handle_command(line, args, dryrun=False):
return
return
if
arg
==
'-print-multiarch'
:
if
arg
==
'-print-multiarch'
:
return
return
if
arg
.
startswith
(
'/tmp'
):
return
if
line
[
0
]
==
'gfortran'
:
if
line
[
0
]
==
'gfortran'
:
result
=
f2c
(
line
)
result
=
f2c
(
line
)
...
@@ -234,6 +236,8 @@ def handle_command(line, args, dryrun=False):
...
@@ -234,6 +236,8 @@ def handle_command(line, args, dryrun=False):
elif
new_args
[
0
]
in
(
'emcc'
,
'em++'
):
elif
new_args
[
0
]
in
(
'emcc'
,
'em++'
):
new_args
.
extend
(
args
.
cflags
.
split
())
new_args
.
extend
(
args
.
cflags
.
split
())
lapack_dir
=
None
# Go through and adjust arguments
# Go through and adjust arguments
for
arg
in
line
[
1
:]:
for
arg
in
line
[
1
:]:
if
arg
.
startswith
(
'-I'
):
if
arg
.
startswith
(
'-I'
):
...
@@ -256,6 +260,34 @@ def handle_command(line, args, dryrun=False):
...
@@ -256,6 +260,34 @@ def handle_command(line, args, dryrun=False):
arg
=
arg
[:
-
3
]
+
'.wasm'
arg
=
arg
[:
-
3
]
+
'.wasm'
output
=
arg
output
=
arg
# Fix for scipy to link to the correct BLAS/LAPACK files
if
arg
.
startswith
(
'-L'
)
and
'CLAPACK-WA'
in
arg
:
out_idx
=
line
.
index
(
'-o'
)
out_idx
+=
1
module_name
=
line
[
out_idx
]
module_name
=
Path
(
module_name
).
name
.
split
(
'.'
)[
0
]
lapack_dir
=
arg
.
replace
(
'-L'
,
''
)
# For convinience we determine needed scipy link libraries
# here, instead of in patch files
link_libs
=
[
'F2CLIBS/libf2c.bc'
,
'blas_WA.bc'
]
if
module_name
in
[
'_flapack'
,
'_flinalg'
,
'_calc_lwork'
,
'cython_lapack'
,
'_iterative'
,
'_arpack'
]:
link_libs
.
append
(
'lapack_WA.bc'
)
for
lib_name
in
link_libs
:
arg
=
os
.
path
.
join
(
lapack_dir
,
f"
{
lib_name
}
"
)
new_args
.
append
(
arg
)
new_args
.
extend
([
'-s'
,
'INLINING_LIMIT=5'
])
continue
# Use -Os for files that are statically linked to CLAPACK
if
(
arg
.
startswith
(
'-O'
)
and
'CLAPACK'
in
' '
.
join
(
line
)
and
'-L'
in
' '
.
join
(
line
)):
new_args
.
append
(
'-Os'
)
continue
new_args
.
append
(
arg
)
new_args
.
append
(
arg
)
# This can only be used for incremental rebuilds -- it generates
# This can only be used for incremental rebuilds -- it generates
...
@@ -316,10 +348,10 @@ def install_for_distribution(args):
...
@@ -316,10 +348,10 @@ def install_for_distribution(args):
try
:
try
:
subprocess
.
check_call
(
commands
)
subprocess
.
check_call
(
commands
)
except
Exception
:
except
Exception
:
print
(
f'Warning:
{
" "
.
join
(
commands
)
}
failed with distutils, possibly
'
print
(
f'Warning:
{
" "
.
join
(
str
(
arg
)
for
arg
in
commands
)
}
failed
'
f'
due to the use of distutils that does not support the
'
f'
with distutils, possibly due to the use of distutils
'
f'
--old-and-unmanageable argument. Re-trying the install
'
f'
that does not support the --old-and-unmanageable
'
f'
without this argument.'
)
'argument. Re-trying the install
without this argument.'
)
subprocess
.
check_call
(
commands
[:
-
1
])
subprocess
.
check_call
(
commands
[:
-
1
])
...
...
run_docker
View file @
04603d53
#!/bin/sh
#!/bin/sh
docker run
--rm
-v
$PWD
:/src
--user
root
-e
NB_UID
=
$UID
-e
NB_GID
=
$GID
-it
iodide/pyodide-env:0.3.
0
/bin/bash
docker run
--rm
-v
$PWD
:/src
--user
root
-e
NB_UID
=
$UID
-e
NB_GID
=
$GID
-it
iodide/pyodide-env:0.3.
1
/bin/bash
test/conftest.py
View file @
04603d53
...
@@ -16,7 +16,7 @@ import shutil
...
@@ -16,7 +16,7 @@ import shutil
TEST_PATH
=
pathlib
.
Path
(
__file__
).
parents
[
0
].
resolve
()
TEST_PATH
=
pathlib
.
Path
(
__file__
).
parents
[
0
].
resolve
()
BUILD_PATH
=
TEST_PATH
/
'..'
/
'build'
BUILD_PATH
=
TEST_PATH
/
'..'
/
'build'
sys
.
path
.
append
(
TEST_PATH
/
'..'
)
sys
.
path
.
append
(
str
(
TEST_PATH
/
'..'
)
)
from
pyodide_build._fixes
import
_selenium_is_connectable
# noqa: E402
from
pyodide_build._fixes
import
_selenium_is_connectable
# noqa: E402
import
selenium.webdriver.common.utils
# noqa: E402
import
selenium.webdriver.common.utils
# noqa: E402
...
@@ -84,7 +84,7 @@ class SeleniumWrapper:
...
@@ -84,7 +84,7 @@ class SeleniumWrapper:
driver
.
get
(
f'http://
{
server_hostname
}
:
{
server_port
}
/test.html'
)
driver
.
get
(
f'http://
{
server_hostname
}
:
{
server_port
}
/test.html'
)
try
:
try
:
wait
.
until
(
PyodideInited
())
wait
.
until
(
PyodideInited
())
except
TimeoutException
as
exc
:
except
TimeoutException
:
_display_driver_logs
(
self
.
browser
,
driver
)
_display_driver_logs
(
self
.
browser
,
driver
)
raise
TimeoutException
()
raise
TimeoutException
()
self
.
wait
=
wait
self
.
wait
=
wait
...
@@ -126,7 +126,7 @@ class SeleniumWrapper:
...
@@ -126,7 +126,7 @@ class SeleniumWrapper:
)
)
try
:
try
:
self
.
wait
.
until
(
PackageLoaded
())
self
.
wait
.
until
(
PackageLoaded
())
except
TimeoutException
as
exc
:
except
TimeoutException
:
_display_driver_logs
(
self
.
browser
,
self
.
driver
)
_display_driver_logs
(
self
.
browser
,
self
.
driver
)
print
(
self
.
logs
)
print
(
self
.
logs
)
raise
TimeoutException
(
'runPythonAsync timed out'
)
raise
TimeoutException
(
'runPythonAsync timed out'
)
...
@@ -163,7 +163,7 @@ class SeleniumWrapper:
...
@@ -163,7 +163,7 @@ class SeleniumWrapper:
__tracebackhide__
=
True
__tracebackhide__
=
True
try
:
try
:
self
.
wait
.
until
(
PackageLoaded
())
self
.
wait
.
until
(
PackageLoaded
())
except
TimeoutException
as
exc
:
except
TimeoutException
:
_display_driver_logs
(
self
.
browser
,
self
.
driver
)
_display_driver_logs
(
self
.
browser
,
self
.
driver
)
print
(
self
.
logs
)
print
(
self
.
logs
)
raise
TimeoutException
(
'wait_until_packages_loaded timed out'
)
raise
TimeoutException
(
'wait_until_packages_loaded timed out'
)
...
...
test/packages/test_scipy.py
0 → 100644
View file @
04603d53
from
textwrap
import
dedent
import
pytest
def
test_scipy_linalg
(
selenium_standalone
,
request
):
selenium
=
selenium_standalone
if
selenium
.
browser
==
'chrome'
:
request
.
applymarker
(
pytest
.
mark
.
xfail
(
run
=
False
,
reason
=
'chrome not supported'
))
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
)
test/test_common.py
View file @
04603d53
...
@@ -23,7 +23,7 @@ def registered_packages_meta():
...
@@ -23,7 +23,7 @@ def registered_packages_meta():
for
name
in
packages
}
for
name
in
packages
}
UNSUPPORTED_PACKAGES
=
{
'chrome'
:
[
'pandas'
],
UNSUPPORTED_PACKAGES
=
{
'chrome'
:
[
'pandas'
,
'scipy'
],
'firefox'
:
[]}
'firefox'
:
[]}
...
@@ -72,10 +72,15 @@ def test_import(name, selenium_standalone):
...
@@ -72,10 +72,15 @@ def test_import(name, selenium_standalone):
"""
"""
)
==
baseline_pyc
)
==
baseline_pyc
loaded_packages
=
[]
for
import_name
in
meta
.
get
(
'test'
,
{}).
get
(
'imports'
,
[]):
for
import_name
in
meta
.
get
(
'test'
,
{}).
get
(
'imports'
,
[]):
if
name
not
in
loaded_packages
:
selenium_standalone
.
load_package
(
name
)
loaded_packages
.
append
(
name
)
try
:
try
:
selenium_standalone
.
run
(
'import %s'
%
import_name
)
selenium_standalone
.
run
(
'import %s'
%
import_name
)
except
Exception
as
e
:
except
Exception
:
print
(
selenium_standalone
.
logs
)
print
(
selenium_standalone
.
logs
)
raise
raise
...
...
test/test_python.py
View file @
04603d53
...
@@ -71,7 +71,7 @@ def test_pythonexc2js(selenium):
...
@@ -71,7 +71,7 @@ def test_pythonexc2js(selenium):
try
:
try
:
selenium
.
run_js
(
'return pyodide.runPython("5 / 0")'
)
selenium
.
run_js
(
'return pyodide.runPython("5 / 0")'
)
except
selenium
.
JavascriptException
as
e
:
except
selenium
.
JavascriptException
as
e
:
assert
(
'ZeroDivisionError'
in
str
(
e
)
)
assert
'ZeroDivisionError'
in
str
(
e
)
else
:
else
:
assert
False
,
'Expected exception'
assert
False
,
'Expected exception'
...
@@ -393,7 +393,7 @@ def test_cpython_core(python_test, selenium, request):
...
@@ -393,7 +393,7 @@ def test_cpython_core(python_test, selenium, request):
if e.code != 0:
if e.code != 0:
raise RuntimeError(f'Failed with code: {{e.code}}')
raise RuntimeError(f'Failed with code: {{e.code}}')
"""
.
format
(
name
))
"""
.
format
(
name
))
except
selenium
.
JavascriptException
as
e
:
except
selenium
.
JavascriptException
:
print
(
selenium
.
logs
)
print
(
selenium
.
logs
)
raise
raise
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment