Skip to content

Commit

Permalink
fix: pdm_build.py added twice in sdist file.
Browse files Browse the repository at this point in the history
Fixes #250

Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Jul 16, 2024
1 parent 30c4614 commit 3dd6d78
Showing 1 changed file with 5 additions and 4 deletions.
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

0 comments on commit 3dd6d78

Please sign in to comment.