From 565bfcd58c0b3cf13f2bd1624d1890ec6b29ccb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Zabalza?= Date: Fri, 8 Nov 2019 12:02:15 +0000 Subject: [PATCH] Fix naima.__version__ --- src/naima/__init__.py | 7 ++++--- src/naima/version.py | 12 +++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/naima/__init__.py b/src/naima/__init__.py index 410a7ea..b22aa05 100644 --- a/src/naima/__init__.py +++ b/src/naima/__init__.py @@ -9,16 +9,17 @@ """ -# Affiliated packages may add whatever they like to this file, but from . import models from .analysis import * from .core import * from .model_fitter import * from .plot import * from .utils import * -from .version import __version__ -# ---------------------------------------------------------------------------- +from .version import get_version + +__version__ = get_version() +del get_version try: diff --git a/src/naima/version.py b/src/naima/version.py index 1322602..74f7e38 100644 --- a/src/naima/version.py +++ b/src/naima/version.py @@ -1,7 +1,9 @@ from pkg_resources import get_distribution, DistributionNotFound -try: - __version__ = get_distribution(__name__).version -except DistributionNotFound: - # package is not installed - __version__ = "" + +def get_version(): + try: + return get_distribution("naima").version + except DistributionNotFound: + # package is not installed + return "UNINSTALLED"