summaryrefslogtreecommitdiff
path: root/numpy/distutils/mingw32ccompiler.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2020-12-13 14:14:49 -0700
committerGitHub <noreply@github.com>2020-12-13 14:14:49 -0700
commit3fe2d9d2627fc0f84aeed293ff8afa7c1f08d899 (patch)
tree2ea27fe06a19c39e8d7a5fe2f87cb7e05363247d /numpy/distutils/mingw32ccompiler.py
parent7d7e446fcbeeff70d905bde2eb0264a797488280 (diff)
parenteff302e5e8678fa17fb3d8156d49eb585b0876d9 (diff)
downloadnumpy-3fe2d9d2627fc0f84aeed293ff8afa7c1f08d899.tar.gz
Merge branch 'master' into fix-issue-10244
Diffstat (limited to 'numpy/distutils/mingw32ccompiler.py')
-rw-r--r--numpy/distutils/mingw32ccompiler.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py
index 7cb6fadcc..3358695a8 100644
--- a/numpy/distutils/mingw32ccompiler.py
+++ b/numpy/distutils/mingw32ccompiler.py
@@ -8,6 +8,7 @@ Support code for building Python extensions on Windows.
"""
import os
+import platform
import sys
import subprocess
import re
@@ -265,16 +266,19 @@ def find_python_dll():
# search in the file system for possible candidates
major_version, minor_version = tuple(sys.version_info[:2])
- patterns = ['python%d%d.dll']
-
- for pat in patterns:
- dllname = pat % (major_version, minor_version)
- print("Looking for %s" % dllname)
- for folder in lib_dirs:
- dll = os.path.join(folder, dllname)
- if os.path.exists(dll):
- return dll
-
+ implementation = platform.python_implementation()
+ if implementation == 'CPython':
+ dllname = f'python{major_version}{minor_version}.dll'
+ elif implementation == 'PyPy':
+ dllname = f'libpypy{major_version}-c.dll'
+ else:
+ dllname = 'Unknown platform {implementation}'
+ print("Looking for %s" % dllname)
+ for folder in lib_dirs:
+ dll = os.path.join(folder, dllname)
+ if os.path.exists(dll):
+ return dll
+
raise ValueError("%s not found in %s" % (dllname, lib_dirs))
def dump_table(dll):