From a3cf5b432d4b6b34562d0a4e2373200d01fe1c66 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Wed, 31 Jul 2024 15:34:06 +0100 Subject: [PATCH] pull alot.__version__ from importlib metadata .. dynamically and remove some other metadata from alot/__init__.py to avoid duplication This is used in `alot -v` but also when setting `UserAgent` for outgoing mails --- alot/__init__.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/alot/__init__.py b/alot/__init__.py index 942b28aa2..6540541e6 100644 --- a/alot/__init__.py +++ b/alot/__init__.py @@ -1,8 +1,17 @@ +from importlib.metadata import version, PackageNotFoundError + +# this requires python >=3.8 +try: + __version__ = version("alot") +except PackageNotFoundError: + # package is not installed + pass + + __productname__ = 'alot' -__version__ = '0.10' -__copyright__ = "Copyright (C) 2012-21 Patrick Totzke" -__author__ = "Patrick Totzke" -__author_email__ = "patricktotzke@gmail.com" +# -__copyright__ = "Copyright (C) 2012-21 Patrick Totzke" +# __author__ = "Patrick Totzke" +# __author_email__ = "patricktotzke@gmail.com" __description__ = "Terminal MUA using notmuch mail" -__url__ = "https://github.com/pazz/alot" -__license__ = "Licensed under the GNU GPL v3+." +# __url__ = "https://github.com/pazz/alot" +# __license__ = "Licensed under the GNU GPL v3+."