Skip to content

Commit 4c2af8a

Browse files
committed
CR fixes
1 parent c3f5ef0 commit 4c2af8a

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/poetry/core/masonry/builders/builder.py

+10
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,16 @@ def convert_author(cls, author: str) -> dict[str, str]:
361361

362362
return {"name": name, "email": email}
363363

364+
def _get_legal_files(self) -> set[Path]:
365+
include_files_patterns = {"COPYING*", "LICEN[SC]E*", "AUTHORS*", "NOTICE*"}
366+
files: set[Path] = set()
367+
368+
for pattern in include_files_patterns:
369+
files.update(self._path.glob(pattern))
370+
371+
files.update(self._path.joinpath("LICENSES").glob("**/*"))
372+
return files
373+
364374

365375
class BuildIncludeFile:
366376
def __init__(

src/poetry/core/masonry/builders/sdist.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,11 @@ def find_nearest_pkg(rel_path: str) -> tuple[str, str]:
320320
def find_files_to_add(self, exclude_build: bool = False) -> set[BuildIncludeFile]:
321321
to_add = super().find_files_to_add(exclude_build)
322322

323-
# add any additional files, starting with all LICENSE files
323+
# add any additional files
324324
additional_files: set[Path] = set()
325-
include_files_patterns = {"COPYING*", "LICEN[SC]E*", "AUTHORS*", "NOTICE*"}
326325

327-
for pattern in include_files_patterns:
328-
additional_files.update(self._path.glob(pattern))
326+
# add legal files
327+
additional_files.update(self._get_legal_files())
329328

330329
# add script files
331330
additional_files.update(self.convert_script_files())

src/poetry/core/masonry/builders/wheel.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -288,15 +288,7 @@ def prepare_metadata(self, metadata_directory: Path) -> Path:
288288
with (dist_info / "METADATA").open("w", encoding="utf-8", newline="\n") as f:
289289
self._write_metadata_file(f)
290290

291-
legal_files: set[Path] = set()
292-
include_files_globs = {"COPYING*", "LICEN[SC]E*", "AUTHORS*", "NOTICE*"}
293-
294-
for file in include_files_globs:
295-
legal_files.update(self._path.glob(file))
296-
297-
legal_files.update(self._path.joinpath("LICENSES").glob("**/*"))
298-
299-
for legal_file in legal_files:
291+
for legal_file in self._get_legal_files():
300292
if not legal_file.is_file():
301293
logger.debug(f"Skipping: {legal_file.as_posix()}")
302294
continue

0 commit comments

Comments
 (0)