You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/lib/ansible_test/_internal/compat/packaging.py

19 lines
534 B
Python

"""Packaging compatibility."""
from __future__ import annotations
import typing as t
try:
from packaging import (
specifiers,
version,
)
SpecifierSet = specifiers.SpecifierSet # type: t.Optional[t.Type[specifiers.SpecifierSet]]
Version = version.Version # type: t.Optional[t.Type[version.Version]]
PACKAGING_IMPORT_ERROR = None
except ImportError as ex:
SpecifierSet = None # pylint: disable=invalid-name
Version = None # pylint: disable=invalid-name
PACKAGING_IMPORT_ERROR = ex