WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions news/3232.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug that `strategy.inherit_metadata` config is not honored when using `--lockfile` option.
11 changes: 6 additions & 5 deletions src/pdm/project/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,16 @@
@property
def lockfile(self) -> Lockfile:
if self._lockfile is None:
self._lockfile = Lockfile(self.root / self.LOCKFILE_FILENAME, ui=self.core.ui)
if self.config.get("use_uv"):
self._lockfile.default_strategies.discard(FLAG_INHERIT_METADATA)
if not self.config["strategy.inherit_metadata"]:
self._lockfile.default_strategies.discard(FLAG_INHERIT_METADATA)
self.set_lockfile(self.root / self.LOCKFILE_FILENAME)
assert self._lockfile is not None
return self._lockfile

def set_lockfile(self, path: str | Path) -> None:
self._lockfile = Lockfile(path, ui=self.core.ui)
if self.config.get("use_uv"):
self._lockfile.default_strategies.discard(FLAG_INHERIT_METADATA)
if not self.config["strategy.inherit_metadata"]:
self._lockfile.default_strategies.discard(FLAG_INHERIT_METADATA)

Check warning on line 214 in src/pdm/project/core.py

View check run for this annotation

Codecov / codecov/patch

src/pdm/project/core.py#L214

Added line #L214 was not covered by tests

@cached_property
def config(self) -> Mapping[str, Any]:
Expand Down
Loading