Skip to content

Commit

Permalink
Revert to original version
Browse files Browse the repository at this point in the history
  • Loading branch information
jace-ys committed Oct 25, 2022
1 parent 523e2aa commit 13560ae
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,8 @@ def find_distribution_files_with_suffix(
for distribution in self.distributions(
name=distribution_name, writable_only=writable_only
):
if not distribution.files:
continue

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 @@ -343,10 +341,8 @@ def find_distribution_files_with_name(
for distribution in self.distributions(
name=distribution_name, writable_only=writable_only
):
if not distribution.files:
continue

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 @@ -376,14 +372,12 @@ def remove_distribution_files(self, distribution_name: str) -> list[Path]:
for distribution in self.distributions(
name=distribution_name, writable_only=True
):
if not distribution.files:
continue

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]
)
# We can't use unlink(missing_ok=True) because it's not always available
# We can't use unlink(missing_ok=True) as it's not always available
if path.exists():
path.unlink()

Expand Down

0 comments on commit 13560ae

Please sign in to comment.