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 bb6e243
Show file tree
Hide file tree
Showing 3 changed files with 47 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.12
- 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
23 changes: 23 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,26 @@ 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
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ setenv =
PYTHONWARNDEFAULTENCODING = 1
# pypa/distutils#99
VIRTUALENV_NO_SETUPTOOLS = 1
pass_env =
DISTUTILS_TEST_DEFAULT_COMPILER
commands =
pytest {posargs}
usedevelop = True
Expand Down

0 comments on commit bb6e243

Please sign in to comment.