Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge with distutils@b7ee725f3 #4539

Merged
merged 62 commits into from
Aug 2, 2024
Merged

Merge with distutils@b7ee725f3 #4539

merged 62 commits into from
Aug 2, 2024

Conversation

jaraco
Copy link
Member

@jaraco jaraco commented Aug 2, 2024

  • Distutils C++ support
  • 👹 Feed the hobgoblins (delint).
  • Adjust tests further to accommodate C++ support.
  • 👹 Feed the hobgoblins (delint).
  • Ignore sysconfig variables for LDCXXSHARED as it appears not to exist on PyPy.
  • ENH: Extension should be able to accept PathLike sources objects
  • Adjust expectation to match behavior.
  • For consistency, ensure Extension.sources is always a pathlib.Path object and adjust expectations in tests.
  • When computing input_opt, ensure src is a string (when it could be a pathlib Path).
  • In filelist, allow for self.files to be pathlib objects.
  • Revert "Disable cygwin tests for now. Ref test_cygwin job failing after adding ruff #3921"
  • find_library_file: port from doctest to normal test and fix for cygwin
  • test_customize_compiler_with_msvc_python: skip for cygwin
  • Simply accept pathlib objects and convert them early for compatibilty with upstream.
  • Prefer f-strings
  • Allow path objects
  • Need to include 'three' in the input.
  • Consolidate str and Path handling.
  • Remove r string now that docstring is gone.
  • Expand convert_path to also accept pathlib.Path objects.
  • 👹 Feed the hobgoblins (delint).
  • Prefer simply 'pathlib' for import.
  • 👹 Feed the hobgoblins (delint).
  • Extract a singledispatchmethod _copy for handling the copy of each data file.
  • Use explicit registration for compatibility with older Pythons.
  • Prefer os.PathLike in convert_path
  • Convert needs to accept None for Setuptools' sake.
  • In test_convert_path, utilize posixpath.join and ntpath.join for maximum compatibility with other libraries.
  • Wrap paths in PurePosixPath to ensure that any WindowsPaths don't get backslashes.
  • convert_path no longer fails if passed a path with a trailing slash. Instead, trailing slashes are stripped just as they are with pathlib.Path.
  • convert_path now converts to a platform-native path.Path, but then calls .as_posix() on it.
  • Separate test_convert_path into two tests to avoid interactions in monkeypatching os.path.
  • Remove expectation that a ValueError is raised for data_files being drive-relative absolute on Windows.
  • Simplify convert_path by simply relying on the logic in PurePath.
  • Harmonize convert_path tests across Unix and Windows.
  • Consolidate convert_path tests and just generate the expected value in a platform-sensitive way. Should fix failures on mingw.
  • Harmonize '-shared' parameter for C and C++ in Mingw32CCompiler
  • In sysconfig.customize_compiler, initialize ldcxxshared from config vars.
  • Refactored customize_compiler to reduce logical branches and extract _add_flags logic.
  • Use simple import
  • CI: add a job for running tests under MSVC CPython with GCC as the default compiler
  • Don't add flags when the value is None, such as when on PyPy, LDCXXSHARED is unset.
  • mingw: make get_msvcr() a noop
  • venv_install_options: add missing clear_argv fixture
  • Remove unused RangeMap
  • Rely on monkeysession to monkeypatch.
  • Apply isort. Ref Apply Scientific Python repo-review suggestions distutils#240
  • Add news fragment.

Summary of changes

Closes

Pull Request Checklist

sciyoshi and others added 30 commits March 2, 2024 10:40
Starting with b42197c UnixCCompiler got some improved support
for cygwin which made the doctest fail.

The doctest is hard to read as is, and adding more platform specific exceptions
wouldn't help, so just convert to a normal test and special case cygwin to make
the test pass there again.
Mingw32CCompiler() checks that the default compiler isn't cygwin,
so it can't be used under cygwin, so skip it there.
jaraco and others added 24 commits August 2, 2024 14:44
Test for convert_path no longer runs on all operating systems as it's too difficult (impossible) to monkeypatch PurePath reliably.
…n a platform-sensitive way. Should fix failures on mingw.
…_add_flags logic.

Reduces cyclomatic complexity so it passes QA checks.
…fault compiler

The tests currently assume everywhere that there is only one compiler per platform,
and while it would be possible to parametrize all the tests it would make things more
complex and we'd also have to decide which compiler is required for running the tests and
which one is optional etc.

To avoid all this introduce a DISTUTILS_TEST_DEFAULT_COMPILER env var which can be used
to override the default compiler type for the whole test run. This keeps the tests as is
and makes sure all tests run against the alternative compiler. Also add it to pass_env
for tox, so it gets passed to pytest, if set.

The added CI job installs an ucrt targeting GCC via MSYS2, and forces the MSVC CPython
to use it via DISTUTILS_TEST_DEFAULT_COMPILER=mingw32.
ENH: Extension should be able to accept PathLike sources objects
This was added back in the day to make mingw use the same CRT as CPython
(https://bugs.python.org/issue870382), but at least with newer mingw-w64 and
ucrt switching the CRT at "runtime" isn't supported anymore. To build a
compatible extension you have to use a ucrt mingw-w64 build, so things match
up and link against the same CRT.

CPython 3.5+ uses ucrt (see https://wiki.python.org/moin/WindowsCompilers), so
anything besides that is no longer relevant, which only leaves vcruntime140.

Since it's not clear what linking against vcruntime140 solves, and there have
been reports of it needing to be patched out:

* #4101
* pypa/distutils#204 (comment)

let's just make it return nothing. Keep get_msvcr() around for now to avoid breaking
code which patched it.

Fixes #204
Otherwise the test fails if arguments are passed to pytest, for example --no-cov:

FAILED distutils/tests/test_dist.py::TestDistributionBehavior::test_venv_install_options -
      distutils.errors.DistutilsArgError: option --no-cov not recognized
Its last use in cygwinccompiler was just removed.
…nv_install_options

venv_install_options: add missing clear_argv fixture
…on-mingw-variant2

mingw: make get_msvcr() a noop + add a CI job testing MSVC Python with GCC
@jaraco
Copy link
Member Author

jaraco commented Aug 2, 2024

Here's the better summary from git:

 setuptools 0ab156c3e 🐚 git log HEAD^1..HEAD^2 --first-parent --oneline
b7ee725f3 Apply isort. Ref pypa/distutils#240
32e5fea1c Rely on monkeysession to monkeypatch.
5f79f228c Merge pull request pypa/distutils#274 from msys2-contrib/ci-msvc-python-mingw-variant2
6748224d9 Merge pull request pypa/distutils#273 from msys2-contrib/tests-fix-venv_install_options
fc76caac7 Merge pull request pypa/distutils#228 from pypa/feature/cpp-support
127371a17 Merge pull request pypa/distutils#237 from pypa/pathlike_ext
9bebfdae3 Merge pull request pypa/distutils#272 from pypa/feature/pathlib-data-files
dcb1bf830 👹 Feed the hobgoblins (delint).
0edebdc35 👹 Feed the hobgoblins (delint).
a6a55cfe0 Remove r string now that docstring is gone.
a30bf5609 Merge https://github.com/jaraco/skeleton
ced21e236 Merge https://github.com/jaraco/skeleton
4b98bf009 Prefer f-strings
718728fdf Merge pull request pypa/distutils#270 from msys2-contrib/fix-cygwin-ci
1bcd839f1 Revert "Disable cygwin tests for now. Ref pypa/setuptools#3921"
3048e1b45 Merge https://github.com/jaraco/skeleton

@jaraco jaraco merged commit 64f10c5 into main Aug 2, 2024
38 checks passed
@jaraco jaraco deleted the feature/distutils-b7ee725f3 branch August 2, 2024 21:11
jaraco added a commit that referenced this pull request Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants