Debian Codegraph @

test/lib/ansible_test/_internal/compat/packaging.py

raw
1 """Packaging compatibility."""
2
3 from __future__ import annotations
4
5 import typing as t
6
7 try:
8 from packaging import (
9 specifiers,
10 version,
11 )
12
13 SpecifierSet: t.Optional[t.Type[specifiers.SpecifierSet]] = specifiers.SpecifierSet
14 Version: t.Optional[t.Type[version.Version]] = version.Version
15 PACKAGING_IMPORT_ERROR = None # pylint: disable=invalid-name
16 except ImportError as ex:
17 SpecifierSet = None # pylint: disable=invalid-name
18 Version = None # pylint: disable=invalid-name
19 PACKAGING_IMPORT_ERROR = ex # pylint: disable=invalid-name