Skip to content

Commit

Permalink
handle importlib-metadata deprecation (#7774)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored Apr 8, 2023
1 parent 860c838 commit f6e1f93
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/poetry/repositories/installed_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,8 @@ def load(cls, env: Env, with_dependencies: bool = False) -> InstalledRepository:
if path in skipped:
continue

try:
name = canonicalize_name(distribution.metadata["name"])
except TypeError:
name = distribution.metadata.get("name") # type: ignore[attr-defined]
if name is None:
logger.warning(
(
"Project environment contains an invalid distribution"
Expand All @@ -271,6 +270,8 @@ def load(cls, env: Env, with_dependencies: bool = False) -> InstalledRepository:
skipped.add(path)
continue

name = canonicalize_name(name)

if name in seen:
continue

Expand Down

0 comments on commit f6e1f93

Please sign in to comment.