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 @ f3b225449 #4444

Merged
merged 103 commits into from
Jul 1, 2024
Merged

Merge with distutils @ f3b225449 #4444

merged 103 commits into from
Jul 1, 2024

Conversation

jaraco
Copy link
Member

@jaraco jaraco commented Jun 28, 2024

  • Port code from CygwinCCompiler to UnixCCompiler
  • ** Add support for building extensions using MinGW compilers**
  • Fix tests for get_msvcr function
  • Make test_customize_compiler run on mingw
  • CI: add msys2 mingw test
  • Fix path separator issue in change_root function
  • test_install: fix an issue specific to mingw
  • Remove testing dependency on jaraco.text
  • Add test for dll_libraries attribute in CygwinCCompiler class
  • Add some tests for Mingw32CCompiler class
  • Support PEP 625
  • Expect to find canonicalize_ functions in packaging.*
  • Update tests to match new expectation.
  • Fix canonicalization
  • In test_sdist, provide a more complex name to capture canonicalization behavior.
  • Add packaging as a vendored package.
  • Use vendored packaging.
  • Remove extra pairs of quotes from litteral strings
  • Revert the canonicalization of the version. Ref [FR] Implement PEP 625 - File Name of a Source Distribution #3593.
  • Revert "Update tests to match new expectation."
  • Pin against pytest 8.1.x due to AttributeError with import-mode importlib and doctest modules pytest-dev/pytest#12194.
  • Move project metadata to pyproject.toml (Move project metadata to pyproject.toml jaraco/skeleton#122)
  • Allow macos on Python 3.8 to fail as GitHub CI has dropped support.
  • Move project.urls to appear in the order that ini2toml generates it. Remove project.scripts.
  • Revert "Allow macos on Python 3.8 to fail as GitHub CI has dropped support."
  • Rename extras to align with core metadata spec.
  • Prefer "Source" to "Homepage" for the repository label.
  • Add 'consolidate_linker_args' wrapper to protect the old behavior for now.
  • Exclude compat package from coverage.
  • Add type declaration for runtime_library_dir_option, making explicit the different return types one might expect.
  • Extend the retention of the compatibility.
  • 👹 Feed the hobgoblins (delint).
  • Move compatibility modules into compat package.
  • Move compatibility module into compat package.
  • Fix return type to match implementation.
  • 🧎‍♀️ Genuflect to the types.
  • Oops. Meant 2025.
  • Migrated config to pyproject.toml using jaraco.develop.migrate-config and ini2toml.
  • Extract _make_executable for TestSpawn.
  • Move and reword comment for brevity and clarity.
  • Remove C901 exclusion; code is now compliant.
  • Remove apparently unnecessary cast to list.
  • Use proper boolean literals.
  • Replace Popen with check_call.
  • Extract function for _debug wrapper.
  • Extract function to inject macos version.
  • 👹 Feed the hobgoblins (delint).
  • Use mkstemp unconditionally. mktemp has been deprecated since Python 2.3.
  • Pin to pytest<8.1.
  • Use a separate build directory for free-threading
  • Deprecate find_executable.
  • Apply canonicalize_version with strip_trailing_zero=False.
  • Apply ruff rule RUF100
  • Move local ruff rules into a local section.
  • Apply ruff rule RUF010
  • Enable ruff rule RUF010
  • Apply ruff/pyupgrade rule UP031
  • Round of ruff format after ruff check
  • Enable ruff/pyupgrade rules (UP)
  • Use set instead of True-only dict
  • Use actual boolean parameters and variables
  • Apply ruff/flake8-implicit-str-concat rule ISC001
  • Apply ruff/flake8-implicit-str-concat rule ISC003
  • Enable ruff/flake8-implicit-str-concat rules (ISC)
  • Combine strings for clarity.
  • CI: run pytest without arguments to avoid stdlib distutils being imported
  • CI: explicitely CC/CXX for clang only mingw environments
  • Extract method for checking macro definition.
  • Extract method for _is_valid_macro.
  • Use brackets for the default value of option arguments
  • Remove unnecessary override to the same value.
  • Suppress EncodingWarnings in docutils.

Summary of changes

Closes

Pull Request Checklist

DWesl and others added 30 commits May 14, 2023 07:00
python-pillow/Pillow#7158 (comment)
suggests that Cygwin uses UnixCCompiler rather than CygwinCCompiler by default, so UnixCCompiler would need to know how to find shared libraries, import libraries, and static libraries on Cygwin.
Simply, run it for the subclasses for `UnixCCompiler`
use `os.sep` instead of hardcoding `\\`
also, fix appropriate tests
it depends on pydantic-core which requires rust to work
also, takes a few minutes to build.
Automated formatting runs such as #149 / ab77f7d left over these extra quotes.
Intentionally omitted specifying `tool.setuptools.include-package-data`: it's true by default in `pyproject.toml` according to https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data.

Closes jaraco/skeleton#121
jaraco and others added 15 commits June 28, 2024 13:37
Use actual boolean parameters and variables
…rted

distutils currently doesn't support pytest collection that doesn't
start at least at the distutils dir or above (and not distutils/tests)
since it requires the local distutils being imported before the tests are run,
otherwise the stdlib distutils takes precedence.

Adjust the pytest call to not pass a path to work around this.

Since pytest currently fails to skip collecting venvs with mingw python
(see pytest-dev/pytest#12544) move the venv
to /tmp instead.
MSYS2 has stopped installing gcc compatibility binaries in clang environments
by default some time ago, and distutils is currently hardcoded to look for "gcc",
while only cc/c++ and clang/clang++ are in PATH.

Work around for now by explicitely setting CC/CXX to override the defaults.

Idealy distutils would try to look harder for a valid compiler before giving up,
but this can be improved in the future.
Apply ruff/flake8-implicit-str-concat rules (ISC)
The goal is to standardize the format of the help text printed
by commands. It is not easy to choose between brackets `[]` and
parentheses `()`. I went for the docopt style, which is the
closest to a standard I could find:

	http://docopt.org/

	[...] and whether that argument has a default value ([default: 10]).
…pport

Add support for building extensions using MinGW compilers
Use brackets for the default value of option arguments
Co-authored-by: DWesl <22566757+DWesl@users.noreply.github.com>
Port code from CygwinCCompiler to UnixCCompiler
@jaraco jaraco force-pushed the feature/distutils-f3b225449 branch from 5ade7db to aa30da4 Compare June 28, 2024 19:14
@jaraco jaraco force-pushed the feature/distutils-f3b225449 branch from aa30da4 to 0f6ed20 Compare June 28, 2024 19:57
@jaraco
Copy link
Member Author

jaraco commented Jun 28, 2024

A more summarized version of the changes:

 setuptools feature/distutils-f3b225449 @ git log HEAD^1..HEAD^2 --first-parent --oneline
f3b225449 Merge pull request pypa/distutils#209 from DWesl/patch-3
131fae7f7 Suppress EncodingWarnings in docutils.
4a742fc8a Merge pull request pypa/distutils#262 from DimitriPapadopoulos/default
b2660613e Merge pull request pypa/distutils#184 from msys2-contrib/add-mingw-support
62135e668 Extract method for _is_valid_macro.
2c86616a0 Extract method for checking macro definition.
7a9818b5d Merge pull request pypa/distutils#255 from DimitriPapadopoulos/ISC
418589c57 Merge pull request pypa/distutils#253 from Avasam/use-actual-booleans
a44f2088f Merge pull request pypa/distutils#252 from Avasam/Use-set-instead-of-True-only-dict
a4bdc7221 Merge pull request pypa/distutils#256 from DimitriPapadopoulos/UP
cb7f154a9 Merge pull request pypa/distutils#257 from DimitriPapadopoulos/RUF010
e79d24489 Merge pull request pypa/distutils#254 from DimitriPapadopoulos/RUF100
c67b200ea Merge pull request pypa/distutils#244 from pypa/feature/canonicalize-fullname
6909af120 Merge pull request pypa/distutils#250 from pypa/debt/remove-find-executable
72b440794 Merge pull request pypa/distutils#260 from brenns10/main
6bf6b9e93 Merge https://github.com/jaraco/skeleton
b93a0ba42 Pin to pytest<8.1.
880d7b11c Merge https://github.com/jaraco/skeleton
213fae9b0 Use mkstemp unconditionally. mktemp has been deprecated since Python 2.3.
8980c8cda Merge https://github.com/jaraco/skeleton
de48bf21f 👹 Feed the hobgoblins (delint).
0bb803608 Extract function to inject macos version.
a4a1f23e9 Extract function for _debug wrapper.
ffdb32da4 Replace Popen with check_call.
671f91369 Use proper boolean literals.
2db55275f Remove apparently unnecessary cast to list.
7babb5d5b Remove C901 exclusion; code is now compliant.
5d2a97eae Move and reword comment for brevity and clarity.
bce1a2251 Extract _make_executable for TestSpawn.
d8ccaf18f Migrated config to pyproject.toml using jaraco.develop.migrate-config and ini2toml.
d746fff01 Oops. Meant 2025.
8a49e92fc 🧎‍♀️ Genuflect to the types.
28d4a09ac Fix return type to match implementation.
6baafbc13 Move compatibility module into compat package.
1bf363bb3 Move compatibility modules into compat package.
d3165d04e 👹 Feed the hobgoblins (delint).
20a372ef0 Merge pull request pypa/distutils#239 from DimitriPapadopoulos/extra_pairs_of_quotes
b3406caf9 Merge pull request pypa/distutils#247 from pypa/hotfix/246-linker-args-list
9eaea6a12 Add type declaration for runtime_library_dir_option, making explicit the different return types one might expect.
491cd2473 Merge pull request pypa/distutils#245 from DimitriPapadopoulos/FURB

@jaraco
Copy link
Member Author

jaraco commented Jun 28, 2024

Tests are passing except for a nuisance diffcov check on easy_install.py. It's possibly covered on Windows, but even if not, I'm not too worried about it considering the support state of easy_install, so I'm inclined to merge without addressing the diffcov failure.

@jaraco jaraco requested a review from abravalheri June 28, 2024 20:21
Copy link
Contributor

@abravalheri abravalheri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for working on this, Jason.

I suppose now we should add to our TODO list to incorporate mingw tests on setuptools, too.

As a brainstorm question: would it make sense to make this a major version bump in setuptools? By itself adding mingw support should be backwards compatible, but I can see that there was some change regarding cygwin too... I wonder if it would be prudent to make a major bump, just in case there are unexpected consequences.

setuptools/_distutils/spawn.py Outdated Show resolved Hide resolved
@jaraco
Copy link
Member Author

jaraco commented Jul 1, 2024

I suppose now we should add to our TODO list to incorporate mingw tests on setuptools, too.

My feeling is no. I'm happy to allow community contributions to support it, but otherwise consider it largely unsupported. Also, we should focus on incorporating distutils into setuptools rather than expanding the divergent implementations. To the extent that incorporating distutils brings the behaviors and tests into Setuptools, then we'll adopt that support (but still contingent on some community maintaining it).

@jaraco
Copy link
Member Author

jaraco commented Jul 1, 2024

would it make sense to make this a major version bump in setuptools? By itself adding mingw support should be backwards compatible, but I can see that there was some change regarding cygwin too... I wonder if it would be prudent to make a major bump, just in case there are unexpected consequences.

Maybe. I'm disinclined to do a major bump out of "extreme caution". I don't expect a lot of users to pin against major versions as a matter of course, or even if they do, I want the major versions to be for well-known breakage (with guidance on how to mitigate the breakage). If we start to release major versions out of undue caution, the major bump will come to be less meaningful. I think I'd prefer to have an articulable breakage before marking it as such.

@jaraco jaraco merged commit e32f8df into main Jul 1, 2024
28 of 32 checks passed
@jaraco jaraco deleted the feature/distutils-f3b225449 branch July 1, 2024 16:12
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.

10 participants