summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--azure-pipelines.yml8
-rw-r--r--tools/openblas_support.py42
2 files changed, 43 insertions, 7 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 59b9944d4..9e9001611 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -191,13 +191,6 @@ jobs:
choco install -y mingw --forcex86 --force --version=5.3.0
displayName: 'Install 32-bit mingw for 32-bit builds'
condition: eq(variables['BITS'], 32)
- - powershell: |
- $wc = New-Object net.webclient
- $gh_base = "https://raw.githubusercontent.com/MacPython/numpy-wheels/master/"
- $wc.Downloadfile($gh_base + "openblas_support.py", "$pwd\openblas_support.py")
- python -c "import openblas_support; openblas_support.make_init('numpy')"
- del openblas_support.py
- displayName: 'Create _distributor_init.py for OpenBlas'
# NOTE: for Windows builds it seems much more tractable to use runtests.py
# vs. manual setup.py and then runtests.py for testing only
- powershell: |
@@ -208,6 +201,7 @@ jobs:
$env:PATH = "C:\\tools\\mingw32\\bin;" + $env:PATH
refreshenv
}
+ python -c "from tools import openblas_support; openblas_support.make_init('numpy')"
pip wheel -v -v -v --wheel-dir=dist .
ls dist -r | Foreach-Object {
diff --git a/tools/openblas_support.py b/tools/openblas_support.py
new file mode 100644
index 000000000..52d283a6c
--- /dev/null
+++ b/tools/openblas_support.py
@@ -0,0 +1,42 @@
+import os
+import textwrap
+
+def make_init(dirname):
+ '''
+ Create a _distributor_init.py file for OpenBlas
+ '''
+ with open(os.path.join(dirname, '_distributor_init.py'), 'wt') as fid:
+ fid.write(textwrap.dedent("""
+ '''
+ Helper to preload windows dlls to prevent dll not found errors.
+ Once a DLL is preloaded, its namespace is made available to any
+ subsequent DLL. This file originated in the numpy-wheels repo,
+ and is created as part of the scripts that build the wheel.
+ '''
+ import os
+ from ctypes import WinDLL
+ import glob
+ if os.name == 'nt':
+ # convention for storing / loading the DLL from
+ # numpy/.libs/, if present
+ try:
+ basedir = os.path.dirname(__file__)
+ except:
+ pass
+ else:
+ libs_dir = os.path.abspath(os.path.join(basedir, '.libs'))
+ DLL_filenames = []
+ if os.path.isdir(libs_dir):
+ for filename in glob.glob(os.path.join(libs_dir,
+ '*openblas*dll')):
+ # NOTE: would it change behavior to load ALL
+ # DLLs at this path vs. the name restriction?
+ WinDLL(os.path.abspath(filename))
+ DLL_filenames.append(filename)
+ if len(DLL_filenames) > 1:
+ import warnings
+ warnings.warn("loaded more than 1 DLL from .libs:\\n%s" %
+ "\\n".join(DLL_filenames),
+ stacklevel=1)
+ """))
+