Skip to content

Commit

Permalink
fix: try a second source for the packaging version in case importlib …
Browse files Browse the repository at this point in the history
…metadata failed (#1656)
  • Loading branch information
franzhaas authored Feb 2, 2023
1 parent 91a500d commit f1b6b50
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pdm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@
from pdm.compat import Distribution, importlib_metadata

_egg_fragment_re = re.compile(r"(.*)[#&]egg=[^&]*")
PACKAGING_22 = Version(importlib_metadata.version("packaging")) >= Version("22")

try:
_packaging_version = importlib_metadata.version("packaging")
except Exception:
from packaging import __version__ as _packaging_version

PACKAGING_22 = Version(_packaging_version) >= Version("22")


def create_tracked_tempdir(
Expand Down

0 comments on commit f1b6b50

Please sign in to comment.