Skip to content

Commit 5722fdb

Browse files
committed
Add notes and allow env var configuration
1 parent efaf816 commit 5722fdb

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ jobs:
113113
# TODO: figure out whether we need/want to use other compilers too
114114
compiler: "gcc"
115115
version: "13"
116+
- name: Set DLL directory environment variable
117+
# Used when running the tests, see `tests/conftest.py` for details
118+
if: ${{ startsWith(matrix.os, 'windows') }}
119+
run: |
120+
echo "PYTHON_ADD_DLL_DIRECTORY=C:\\mingw64\\bin" >> $GITHUB_ENV
121+
116122
- uses: ./.github/actions/setup
117123
with:
118124
python-version: ${{ matrix.python-version }}

tests/conftest.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@
55
"""
66

77
import os
8-
import sys
98

10-
if os.environ.get("CI", "false") == "true" and sys.platform == "win32":
11-
os.add_dll_directory("C:\\mingw64\\bin")
9+
if dll_directory_to_add := os.environ.get("PYTHON_ADD_DLL_DIRECTORY", None):
10+
# Add the directory which has the libgfortran.dll file.
11+
#
12+
# A super deep dive into this is here:
13+
# https://stackoverflow.com/a/78276248
14+
# The tl;dr is - mingw64's linker can be tricked by windows craziness
15+
# into linking a dynamic library even when we wanted only static links,
16+
# so if you want to avoid this, link with something else (e.g. the MS linker).
17+
# (From what I know, this isn't an issue for the built wheels
18+
# thanks to the cleverness of delvewheel)
19+
os.add_dll_directory(dll_directory_to_add)
20+
# os.add_dll_directory("C:\\mingw64\\bin")

0 commit comments

Comments
 (0)