1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
PackageNotFoundError = None
DistributionNotFound = None
try:
from importlib.metadata import PackageNotFoundError
from importlib.metadata import version as get_version
except ImportError:
get_version = None
PackageNotFoundError = None
if get_version is None:
try:
from pkg_resources import DistributionNotFound, get_distribution
def get_version(x):
return get_distribution(x).version
except ImportError:
get_version = None
DistributionNotFound = None
get_distribution = None
__version__ = None
if get_version is not None:
try:
__version__ = get_version("django-pipeline")
except PackageNotFoundError:
pass
except DistributionNotFound:
pass
|