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

data_dir lacks optional build tag #193

Open
tibdex opened this issue Aug 3, 2023 · 2 comments
Open

data_dir lacks optional build tag #193

tibdex opened this issue Aug 3, 2023 · 2 comments
Labels
component: destinations Related to WheelDestination and friends type: bug A confirmed bug or unintended behavior

Comments

@tibdex
Copy link

tibdex commented Aug 3, 2023

This is related to #171 but this issue impacts all wheels with a build tag and data files.

For example, using the following command to create a wheel for a package named foo with version 0.4.2:

python setup.py bdist_wheel --build-number 1337

will create a wheel named foo-0.4.2-1337-py3-none-any.whl. The build_tag in:

WheelFilename = namedtuple(
"WheelFilename", ["distribution", "version", "build_tag", "tag"]
)

will be 1337.

Data files in the wheel will have paths such as foo-0.4.2-1337.data/some_folder/some_file.txt. Due to the implementation of data_dir:

@property
def data_dir(self) -> str:
"""Name of the data directory."""
return f"{self.distribution}-{self.version}.data"

we'll thus have the following variable values here:

if posixpath.commonprefix([data_dir, path]) != data_dir:

assert data_dir == "foo-0.4.2.data"
assert path == "foo-0.4.2-1337.data/some_folder/some_file.txt"
assert posixpath.commonprefix([data_dir, path]) == "foo-0.4.2"
assert posixpath.commonprefix([data_dir, path]) != data_dir
# -> the scheme is incorrectly determined as root_scheme.

Can the implementation of data_dir be changed to take into account the wheel's build tag?


Environment:

  • Python 3.9.17
  • setuptools 67.7.2
  • installer 0.7.0
@eli-schwartz
Copy link
Contributor

This sounds like exactly the opposite of pypa/setuptools#3997 and is probably a setuptools/wheel bug for generating a non spec-compliant artifact.

but this issue impacts all wheels with a build tag

Presumably it doesn't include any wheels that possess only modules/packages and don't have data files / headers / scripts. So it would impact the minority of wheels, really.

@tibdex
Copy link
Author

tibdex commented Aug 3, 2023

Presumably it doesn't include any wheels that possess only modules/packages and don't have data files / headers / scripts. So it would impact the minority of wheels, really.

Yes you're right, I'll edit the issue description for future readers.

@Secrus Secrus added type: bug A confirmed bug or unintended behavior component: destinations Related to WheelDestination and friends labels Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: destinations Related to WheelDestination and friends type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants