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

fix: pdm_build.py added twice in sdist file. #251

Merged
merged 1 commit into from
Jul 16, 2024
Merged
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
9 changes: 5 additions & 4 deletions src/pdm/backend/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ class SdistBuilder(Builder):
target = "sdist"

def get_files(self, context: Context) -> Iterable[tuple[str, Path]]:
yield from super().get_files(context)
collected = dict(super().get_files(context))
local_hook = self.config.build_config.custom_hook
context.ensure_build_dir()
context.config.write_to(context.build_dir / "pyproject.toml")
yield "pyproject.toml", context.build_dir / "pyproject.toml"
collected["pyproject.toml"] = context.build_dir / "pyproject.toml"

additional_files: Iterable[str] = filter(
None,
lambda f: f is not None and f not in collected,
(
local_hook,
self.config.metadata.readme_file,
Expand All @@ -59,7 +59,8 @@ def get_files(self, context: Context) -> Iterable[tuple[str, Path]]:
root = self.location
for file in additional_files:
if root.joinpath(file).exists():
yield file, root / file
collected[file] = root / file
return collected.items()

def build_artifact(
self, context: Context, files: Iterable[tuple[str, Path]]
Expand Down