|
19 | 19 | # All configuration values have a default; values that are commented out
|
20 | 20 | # serve to show the default.
|
21 | 21 |
|
22 |
| -import sys |
23 | 22 | import os
|
| 23 | +from pathlib import Path |
24 | 24 | from runpy import run_path
|
25 |
| -from configparser import ConfigParser |
| 25 | + |
| 26 | +import toml |
26 | 27 |
|
27 | 28 | # Check for external Sphinx extensions we depend on
|
28 | 29 | try:
|
|
41 | 42 | raise RuntimeError('Need nibabel on Python PATH; consider "make htmldoc" '
|
42 | 43 | 'from nibabel root directory')
|
43 | 44 |
|
44 |
| -# If extensions (or modules to document with autodoc) are in another directory, |
45 |
| -# add these directories to sys.path here. If the directory is relative to the |
46 |
| -# documentation root, use os.path.abspath to make it absolute, like shown here. |
47 |
| -# sys.path.append(os.path.abspath('../sphinxext')) |
48 |
| - |
49 | 45 | # -- General configuration ----------------------------------------------------
|
50 | 46 |
|
51 | 47 | # We load the nibabel release info into a dict by explicit execution
|
|
56 | 52 | fobj.write(rel['long_description'])
|
57 | 53 |
|
58 | 54 | # Load metadata from setup.cfg
|
59 |
| -config = ConfigParser() |
60 |
| -config.read(os.path.join('..', '..', 'setup.cfg')) |
61 |
| -metadata = config['metadata'] |
| 55 | +pyproject_dict = toml.load(Path("../../pyproject.toml")) |
| 56 | +metadata = pyproject_dict["project"] |
62 | 57 |
|
63 | 58 | # Add any Sphinx extension module names here, as strings. They can be
|
64 | 59 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
|
92 | 87 |
|
93 | 88 | # General information about the project.
|
94 | 89 | project = u'NiBabel'
|
95 |
| -copyright = f"2006-2022, {metadata['maintainer']} <{metadata['author_email']}>" |
| 90 | +author_name = metadata["authors"][0]["name"] |
| 91 | +author_email = metadata["authors"][0]["email"] |
| 92 | +copyright = f"2006-2022, {author_name} <{author_email}>" |
96 | 93 |
|
97 | 94 | # The version info for the project you're documenting, acts as replacement for
|
98 | 95 | # |version| and |release|, also used in various other places throughout the
|
|
0 commit comments