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

Update wheel.py to support generic tag when no extensions found #598

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/poetry/core/masonry/builders/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(
self._original_path = original.parent
self._editable = editable
self._metadata_directory = metadata_directory
self._has_libs: bool | None = None

@classmethod
def make_in(
Expand Down Expand Up @@ -189,6 +190,7 @@ def _build(self, wheel: zipfile.ZipFile) -> None:
# The result of building the extensions
# does not exist, this may due to conditional
# builds, so we assume that it's okay
self._has_libs = False
return

lib = libs[0]
Expand Down Expand Up @@ -369,9 +371,13 @@ def _get_sys_tags(self) -> list[str]:
)
return decode(output).strip().splitlines()

@property
def is_pure_lib(self) -> bool:
return self._package.build_script is None or self._has_libs is False

@property
def tag(self) -> str:
if self._package.build_script:
if not self.is_pure_lib:
if self.executable != Path(sys.executable):
# poetry-core is not run in the build environment
# -> this is probably not a PEP 517 build but a poetry build
Expand Down Expand Up @@ -455,7 +461,7 @@ def _write_wheel_file(self, fp: TextIO) -> None:
fp.write(
wheel_file_template.format(
version=__version__,
pure_lib="true" if self._package.build_script is None else "false",
pure_lib=str(self.is_pure_lib).lower(),
tag=self.tag,
)
)
Expand Down