# HG changeset patch # User Franz Glasner # Date 1777210495 -7200 # Node ID 5c0f26a21e81956fa34d65c2237848fa253a7014 # Parent fcc34b24ded7c930525de8a90b04ed0141e0ffbf Determine "release" dynamically from the package's "__version__" diff -r fcc34b24ded7 -r 5c0f26a21e81 docs/conf.py --- a/docs/conf.py Sun Apr 26 15:06:58 2026 +0200 +++ b/docs/conf.py Sun Apr 26 15:34:55 2026 +0200 @@ -3,13 +3,27 @@ # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html +import ast +import io +import re + # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information project = 'Pygments Pseudocode Lexer' copyright = '2026, Franz Glasner' author = 'Franz Glasner' -release = '2.0.1' +# Determine "release" dynamically from the package's "__version__" +with io.open("../pygments_lexer_pseudocode2/__init__.py", + "rt", + encoding="utf-8") as relfp: + release = ast.literal_eval( + re.search(r"""^\s*__version__\s*=\s*(("|')[^"']*\2)""", + relfp.read(), + re.MULTILINE) + .group(1) + ) +del relfp # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration