|
12 | 12 | # |
13 | 13 | import os |
14 | 14 | import sys |
15 | | -import tomli |
| 15 | +try: |
| 16 | + import tomli as toml # For python < 3.11 |
| 17 | + |
| 18 | +except ImportError: |
| 19 | + import tomllib as toml # For python >= 3.11 |
| 20 | + |
16 | 21 | base_path = os.path.split(os.path.join(os.path.abspath(os.path.dirname(__name__))))[0] |
17 | 22 | sys.path.append(base_path) |
18 | 23 |
|
19 | | -# Reads version.py and converts to a dict of keys |
20 | | -version_py = {} |
21 | | -with open(os.path.join(base_path, 'pyats_genie_command_parse', 'version.py'), 'r', encoding='utf-8') as f: |
22 | | - exec(f.read(), version_py) |
23 | | - |
24 | 24 | # Reads pyproject.toml and converts to python objects |
25 | 25 | with open(os.path.join(base_path, 'pyproject.toml'), 'r', encoding='utf-8') as file: |
26 | | - toml = file.read() |
27 | | -pyproject_toml = tomli.loads(toml) |
| 26 | + toml_data = file.read() |
| 27 | +pyproject_toml = toml.loads(toml_data) |
28 | 28 |
|
29 | 29 | # -- Added for readthedocs.org ----------------------------------------------- |
30 | 30 |
|
|
33 | 33 | # -- Project information ----------------------------------------------------- |
34 | 34 |
|
35 | 35 | # The full version, including alpha/beta/rc tags |
36 | | -release = version_py['__version__'] |
| 36 | +release = f"{pyproject_toml['project']['version']}" |
37 | 37 | project = f"{pyproject_toml['project']['name']} v{release}" |
38 | | -copyright = version_py['__copyright__'] |
| 38 | +copyright = "Copyright (c) 2020 - 2025, Benjamin P. Trachtenberg, Brett Gianpetro" |
39 | 39 |
|
40 | 40 | # Reads authors from pyproject.toml and adds name to list |
41 | 41 | authors = [] |
|
0 commit comments