Recognize build tags in wheel data directories - #343
Conversation
yangfan-yf-yf
left a comment
There was a problem hiding this comment.
The optional build tag belongs only in the wheel filename. The wheel specification defines the data directory as the dist-info directory name with the extension changed to .data, so a build-tagged wheel still uses distribution-version.data.
Changing WheelFile.data_dir to include self._build_tag makes a compliant wheel such as fancy-1.0.0-1337-py3-none-any.whl with fancy-1.0.0.data/data/... no longer match the data scheme. The new fixture and assertions instead encode the non-standard fancy-1.0.0-1337.data layout.
Could this preserve the required distribution-version.data handling for build-tagged wheels? If compatibility with legacy non-standard artifacts is desired, it needs to be additive rather than replacing the standard directory name, with regression coverage for both layouts.
Fixes #193.
This updates
WheelFile.data_dirto include the optional wheel build tag parsed from the wheel filename, so files under directories such asfoo-0.4.2-1337.data/are routed through the wheel.datascheme instead of being treated as root-scheme files.The base
WheelSourcebehavior is unchanged for callers that construct sources without a wheel filename.Tests added:
WheelFile.data_dirincludes the build tag for build-tagged wheels.install()routes a build-tagged wheel data file to thedatascheme.Checks run locally:
PYTHONPATH=src python -m pytest tests\test_sources.py::TestWheelFile::test_build_tag_is_part_of_data_dir tests\test_core.py::TestInstall::test_handles_wheel_data_dir_with_build_tag -qPYTHONPATH=src python -m pytest tests\test_sources.py tests\test_core.py -qPYTHONPATH=src python -m pytest -qpython -m ruff check src testspython -m ruff format --check src testsPYTHONPATH=src python -m mypy srcgit diff --check