Skip to content

Commit

Permalink
chore: show warning when resolving agains cross platform targets unde…
Browse files Browse the repository at this point in the history
…r uv mode

Fix #3341

Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Dec 10, 2024
1 parent 72d078a commit b639c39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/3341.misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Show a warning when resolving against cross-platform targets under uv mode.
10 changes: 10 additions & 0 deletions src/pdm/resolver/uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ def __post_init__(self) -> None:
if FLAG_INHERIT_METADATA in self.strategies:
self.project.core.ui.warn("inherit_metadata strategy is not supported by uv resolver, it will be ignored")
self.strategies.discard(FLAG_INHERIT_METADATA)
this_spec = self.environment.spec
assert this_spec.platform is not None
if self.target.platform and (
self.target.platform.sys_platform != this_spec.platform.sys_platform
or self.target.platform.arch != this_spec.platform.arch
):
self.project.core.ui.warn(
f"Resolving against target {self.target.platform} on {this_spec.platform} is not supported by uv mode, "
"the resolution may be inaccurate."
)

def _build_lock_command(self) -> list[str]:
cmd = [*self.project.core.uv_cmd, "lock", "-p", str(self.environment.interpreter.executable)]
Expand Down

0 comments on commit b639c39

Please sign in to comment.