-
-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
PackageNotFoundError = None | ||
DistributionNotFound = None | ||
try: | ||
from importlib.metadata import PackageNotFoundError | ||
from importlib.metadata import version as get_version | ||
except ImportError: | ||
get_version = None | ||
try: | ||
from pkg_resources import DistributionNotFound as PackageNotFoundError | ||
from pkg_resources import get_distribution | ||
|
||
|
||
def get_version(x): | ||
return get_distribution(x).version | ||
except ImportError: | ||
get_version = None | ||
PackageNotFoundError = None | ||
get_distribution = 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 | ||