Skip to content

Commit

Permalink
Handle distribution.files being None
Browse files Browse the repository at this point in the history
  • Loading branch information
jace-ys authored and jace-ys committed Oct 24, 2022
1 parent 5c578a2 commit ff0cb20
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ def find_distribution_files_with_suffix(
for distribution in self.distributions(
name=distribution_name, writable_only=writable_only
):
assert distribution.files is not None
for file in distribution.files:
files = [] if distribution.files is None else distribution.files
for file in files:
if file.name.endswith(suffix):
yield Path(
distribution.locate_file(file), # type: ignore[no-untyped-call]
Expand All @@ -341,8 +341,8 @@ def find_distribution_files_with_name(
for distribution in self.distributions(
name=distribution_name, writable_only=writable_only
):
assert distribution.files is not None
for file in distribution.files:
files = [] if distribution.files is None else distribution.files
for file in files:
if file.name == name:
yield Path(
distribution.locate_file(file), # type: ignore[no-untyped-call]
Expand Down Expand Up @@ -372,8 +372,8 @@ def remove_distribution_files(self, distribution_name: str) -> list[Path]:
for distribution in self.distributions(
name=distribution_name, writable_only=True
):
assert distribution.files is not None
for file in distribution.files:
files = [] if distribution.files is None else distribution.files
for file in files:
path = Path(
distribution.locate_file(file), # type: ignore[no-untyped-call]
)
Expand Down

0 comments on commit ff0cb20

Please sign in to comment.