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+." diff --git a/docs/source/conf.py b/docs/source/conf.py index 98761a23d..35ab9ed77 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -2,6 +2,7 @@ # alot documentation build configuration file import pathlib import tomllib +import importlib.metadata pyproject = pathlib.Path(__file__).parent.parent.parent / "pyproject.toml" with pyproject.open("rb") as f: @@ -54,9 +55,9 @@ # built documents. # # The short X.Y version. -version = project_data["version"] +version = importlib.metadata.version("alot") # The full version, including alpha/beta/rc tags. -release = project_data["version"] +release = importlib.metadata.version("alot") # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/flake.nix b/flake.nix index 66e16d22f..64b8ecdd1 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,7 @@ packages = { alot = pkgs.python3Packages.buildPythonApplication { name = "alot"; - version = pyproject.project.version + "-post"; + version = "0.dev+${if self ? shortRev then self.shortRev else "dirty"}"; src = self; pyproject = true; outputs = [ diff --git a/pyproject.toml b/pyproject.toml index 8149e1141..ac26a7b2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,6 @@ build-backend = "setuptools.build_meta" [project] name = "alot" -version = "0.10" description = "Terminal MUA using notmuch mail" authors = [ {name="Patrick Totzke", email="patricktotzke@gmail.com"} @@ -14,6 +13,7 @@ maintainers = [ {name="Lucas Hoffmann", email="lucc@posteo.de"}, ] readme = "README.md" +dynamic = ["version"] requires-python = ">=3.8" license = { text = "GPL-3.0-or-later" } classifiers = [ @@ -49,3 +49,5 @@ Issues = "https://github.com/pazz/alot/issues" [tool.setuptools.packages.find] include = ["alot*"] + +[tool.setuptools_scm] diff --git a/readthedocs.yaml b/readthedocs.yaml index bed40597b..aa7ba064d 100644 --- a/readthedocs.yaml +++ b/readthedocs.yaml @@ -7,7 +7,22 @@ build: os: ubuntu-22.04 tools: python: "3.12" + apt_packages: + - libmagic1 # for python-magic + jobs: + # remove and mock problematic dependencies + pre_install: + - sed -i -e /gpg/d -e /notmuch2/d pyproject.toml + - touch gpg.py + - echo NullPointerError = NotmuchError = None > notmuch2.py + # make the git state clean again for setuptools_scm + post_install: + - git checkout pyproject.toml +# Install alot itself before building the docs +python: + install: + - path: . # Build documentation in the "docs/" directory with Sphinx sphinx: configuration: docs/source/conf.py