summaryrefslogtreecommitdiff
path: root/numpy/f2py/tests/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/f2py/tests/util.py')
-rw-r--r--numpy/f2py/tests/util.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/numpy/f2py/tests/util.py b/numpy/f2py/tests/util.py
index ad8c7a37e..26fa7e49d 100644
--- a/numpy/f2py/tests/util.py
+++ b/numpy/f2py/tests/util.py
@@ -6,6 +6,7 @@ Utility functions for
- determining paths to tests
"""
+import glob
import os
import sys
import subprocess
@@ -20,7 +21,7 @@ import numpy
from pathlib import Path
from numpy.compat import asbytes, asstr
-from numpy.testing import temppath
+from numpy.testing import temppath, IS_WASM
from importlib import import_module
#
@@ -30,6 +31,10 @@ from importlib import import_module
_module_dir = None
_module_num = 5403
+if sys.platform == "cygwin":
+ NUMPY_INSTALL_ROOT = Path(__file__).parent.parent.parent
+ _module_list = list(NUMPY_INSTALL_ROOT.glob("**/*.dll"))
+
def _cleanup():
global _module_dir
@@ -147,6 +152,21 @@ def build_module(source_files, options=[], skip=[], only=[], module_name=None):
for fn in dst_sources:
os.unlink(fn)
+ # Rebase (Cygwin-only)
+ if sys.platform == "cygwin":
+ # If someone starts deleting modules after import, this will
+ # need to change to record how big each module is, rather than
+ # relying on rebase being able to find that from the files.
+ _module_list.extend(
+ glob.glob(os.path.join(d, "{:s}*".format(module_name)))
+ )
+ subprocess.check_call(
+ ["/usr/bin/rebase", "--database", "--oblivious", "--verbose"]
+ + _module_list
+ )
+
+
+
# Import
return import_module(module_name)
@@ -187,6 +207,9 @@ def _get_compiler_status():
return _compiler_status
_compiler_status = (False, False, False)
+ if IS_WASM:
+ # Can't run compiler from inside WASM.
+ return _compiler_status
# XXX: this is really ugly. But I don't know how to invoke Distutils
# in a safer way...