Add sdist metadata regression test and fix version sanitization - #256
Merged
Conversation
pip re-runs setup.py inside the extracted sdist (where there is no git metadata) to prepare installation metadata. If the version cannot be recovered there, the metadata falls back to 1.0.0 and pip discards the archive with 'inconsistent version' (see #253). - Make sanitize_version() handle exact tags: v1.5.2 now sanitizes to 1.5.2 instead of keeping the leading 'v' (which was only saved by setuptools' lenient version normalization). - Add tests/test_sdist_metadata.py: builds the sdist, verifies it ships version.mk and the C sources, re-runs egg_info in a git-free copy of the archive and asserts the regenerated metadata version matches the archive name. - Run that test in the build-linux-wheels CI job.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Follow-up to #253 (broken sdist metadata) and the already-merged sdist fix (#255).
pip prepares an sdist's metadata by re-running
setup.pyinside the extractedarchive, where there is no git metadata. If the version can't be recovered there,
pacparser_version()falls back to1.0.0and pip discards the file with"inconsistent version" — the symptom in #253.
This PR hardens that path and adds a guard so it can't silently regress:
sanitize_version(): now handles exact tags.v1.5.2sanitizes to1.5.2instead of keeping the leading
v(previously only rescued by setuptools'lenient normalization).
version.mknow carries a clean PEP 440 version.tests/test_sdist_metadata.py(new): builds the sdist, verifies it shipsversion.mk+ the C sources, re-runsegg_infoin a git-free copy of thearchive (exactly what pip does), and asserts the regenerated metadata version
equals the archive name.
build-linux-wheelsjob right after the sdistbuild.
Verified:
missing version.mk in sdist) — it catches the Broken metadata: 1.3.9..1.5.1 versions #253 regression.v1.5.2→ sdist → git-freeegg_info→ wheel →install): metadata version is
1.5.2end to end, and the installed modulereports
version() == 1.5.2and parses PAC files.NO_INTERNET=1 make -C srcandmake -C src pymodpass.Note: closing #253 also requires cutting the next release (tag + GitHub Release)
so CI publishes a corrected sdist; this PR makes that release safe and
self-verifying.