Skip to content

Commit f6fd865

Browse files
Secrusradoering
authored andcommitted
CR fixes
1 parent eb92ee4 commit f6fd865

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
@@ -379,6 +379,16 @@ def convert_author(cls, author: str) -> dict[str, str]:
379379

380380
return {"name": name, "email": email}
381381

382+
def _get_legal_files(self) -> set[Path]:
383+
include_files_patterns = {"COPYING*", "LICEN[SC]E*", "AUTHORS*", "NOTICE*"}
384+
files: set[Path] = set()
385+
386+
for pattern in include_files_patterns:
387+
files.update(self._path.glob(pattern))
388+
389+
files.update(self._path.joinpath("LICENSES").glob("**/*"))
390+
return files
391+
382392

383393
class BuildIncludeFile:
384394
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)