Skip to content

Commit

Permalink
handle importlib-metadata deprecation
Browse files Browse the repository at this point in the history
importlib-metadata promises that it will start raising KeyError for
missing values, rather than returning None
  • Loading branch information
dimbleby committed Apr 7, 2023
1 parent 860c838 commit 246a65b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/poetry/repositories/installed_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,7 @@ def load(cls, env: Env, with_dependencies: bool = False) -> InstalledRepository:
if path in skipped:
continue

try:
name = canonicalize_name(distribution.metadata["name"])
except TypeError:
if "name" not in distribution.metadata:
logger.warning(
(
"Project environment contains an invalid distribution"
Expand All @@ -271,6 +269,8 @@ def load(cls, env: Env, with_dependencies: bool = False) -> InstalledRepository:
skipped.add(path)
continue

name = canonicalize_name(distribution.metadata["name"])

if name in seen:
continue

Expand Down

0 comments on commit 246a65b

Please sign in to comment.