Skip to content

Commit 3dd6d78

Browse files
committed
fix: pdm_build.py added twice in sdist file.
Fixes #250 Signed-off-by: Frost Ming <me@frostming.com>
1 parent 30c4614 commit 3dd6d78

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/pdm/backend/sdist.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ class SdistBuilder(Builder):
4242
target = "sdist"
4343

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

5151
additional_files: Iterable[str] = filter(
52-
None,
52+
lambda f: f is not None and f not in collected,
5353
(
5454
local_hook,
5555
self.config.metadata.readme_file,
@@ -59,7 +59,8 @@ def get_files(self, context: Context) -> Iterable[tuple[str, Path]]:
5959
root = self.location
6060
for file in additional_files:
6161
if root.joinpath(file).exists():
62-
yield file, root / file
62+
collected[file] = root / file
63+
return collected.items()
6364

6465
def build_artifact(
6566
self, context: Context, files: Iterable[tuple[str, Path]]

0 commit comments

Comments
 (0)