comparison docs/conf.py @ 49:5c0f26a21e81

Determine "release" dynamically from the package's "__version__"
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 26 Apr 2026 15:34:55 +0200
parents fcc34b24ded7
children e6354e3abbec
comparison
equal deleted inserted replaced
48:fcc34b24ded7 49:5c0f26a21e81
1 # Configuration file for the Sphinx documentation builder. 1 # Configuration file for the Sphinx documentation builder.
2 # 2 #
3 # For the full list of built-in configuration values, see the documentation: 3 # For the full list of built-in configuration values, see the documentation:
4 # https://www.sphinx-doc.org/en/master/usage/configuration.html 4 # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
6 import ast
7 import io
8 import re
5 9
6 # -- Project information ----------------------------------------------------- 10 # -- Project information -----------------------------------------------------
7 # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information 11 # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8 12
9 project = 'Pygments Pseudocode Lexer' 13 project = 'Pygments Pseudocode Lexer'
10 copyright = '2026, Franz Glasner' 14 copyright = '2026, Franz Glasner'
11 author = 'Franz Glasner' 15 author = 'Franz Glasner'
12 release = '2.0.1' 16 # Determine "release" dynamically from the package's "__version__"
17 with io.open("../pygments_lexer_pseudocode2/__init__.py",
18 "rt",
19 encoding="utf-8") as relfp:
20 release = ast.literal_eval(
21 re.search(r"""^\s*__version__\s*=\s*(("|')[^"']*\2)""",
22 relfp.read(),
23 re.MULTILINE)
24 .group(1)
25 )
26 del relfp
13 27
14 # -- General configuration --------------------------------------------------- 28 # -- General configuration ---------------------------------------------------
15 # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration 29 # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
16 30
17 extensions = [] 31 extensions = []