Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lazka committed Jul 21, 2024
1 parent e1e9f61 commit 324ff2e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,28 @@ jobs:
source /tmp/venv/bin/activate
pytest
test_msvc_python_mingw:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install tox
run: python -m pip install tox
- name: Install GCC
uses: msys2/setup-msys2@v2
with:
msystem: ucrt64
install: mingw-w64-ucrt-x86_64-cc
- name: Run
run: |
$env:MSYS2_ROOT = msys2 -c 'cygpath -m /'
$env:PATH = "$env:MSYS2_ROOT/ucrt64/bin;$env:PATH"
$env:DISTUTILS_TEST_DEFAULT_COMPILER = "mingw32"
tox
ci_setuptools:
# Integration testing with setuptools
strategy:
Expand Down
22 changes: 22 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,25 @@ def disable_macos_customization(monkeypatch):
from distutils import sysconfig

monkeypatch.setattr(sysconfig, '_customize_macos', lambda: None)


@pytest.fixture(autouse=True, scope="session")
def monkey_patch_get_default_compiler():
"""
Monkey patch distutils get_default_compiler to allow overriding the
default compiler. Mainly to test mingw32 with a MSVC Python.
"""
from distutils import ccompiler

default_compiler = os.environ.get("DISTUTILS_TEST_DEFAULT_COMPILER")

if default_compiler is not None:
def patched_get_default_compiler(*args, **kwargs):
return default_compiler

original = ccompiler.get_default_compiler
ccompiler.get_default_compiler = patched_get_default_compiler
yield
ccompiler.get_default_compiler = original
else:
yield

0 comments on commit 324ff2e

Please sign in to comment.