|
| 1 | +# Configuration file for the Sphinx documentation builder. |
| 2 | +# |
| 3 | +# For the full list of built-in configuration values, see the documentation: |
| 4 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html |
| 5 | + |
| 6 | +# -- Project information ----------------------------------------------------- |
| 7 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information |
| 8 | + |
| 9 | + |
| 10 | +import os |
| 11 | +import inspect |
| 12 | +import shutil |
| 13 | + |
| 14 | +try: # for Sphinx >= 1.7 |
| 15 | + from sphinx.ext import apidoc |
| 16 | +except ImportError: |
| 17 | + from sphinx import apidoc |
| 18 | + |
| 19 | +__location__ = os.path.join( |
| 20 | + os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())) |
| 21 | +) |
| 22 | + |
| 23 | +print(__location__) |
| 24 | + |
| 25 | +output_dir = os.path.join(__location__, "api") |
| 26 | +module_dir = os.path.join(__location__, "../eoxmagmod/eoxmagmod") |
| 27 | + |
| 28 | + |
| 29 | +try: |
| 30 | + shutil.rmtree(output_dir) |
| 31 | +except FileNotFoundError: |
| 32 | + pass |
| 33 | + |
| 34 | +try: |
| 35 | + import sphinx |
| 36 | + |
| 37 | + cmd_line_template = ( |
| 38 | + "sphinx-apidoc --implicit-namespaces -f -o {outputdir} {moduledir}" |
| 39 | + ) |
| 40 | + cmd_line = cmd_line_template.format(outputdir=output_dir, moduledir=module_dir) |
| 41 | + |
| 42 | + args = cmd_line.split(" ") |
| 43 | + if tuple(sphinx.__version__.split(".")) >= ("1", "7"): |
| 44 | + # This is a rudimentary parse_version to avoid external dependencies |
| 45 | + args = args[1:] |
| 46 | + |
| 47 | + apidoc.main(args) |
| 48 | +except Exception as e: |
| 49 | + print("Running `sphinx-apidoc` failed!\n{}".format(e)) |
| 50 | + |
| 51 | + |
| 52 | +def setup(app): |
| 53 | + app.add_css_file("css/custom.css") |
| 54 | + |
| 55 | + |
| 56 | +project = 'MagneticModel' |
| 57 | +copyright = '2022, dolezalovat' |
| 58 | +author = 'dolezalovat' |
| 59 | + |
| 60 | + |
| 61 | +# -- General configuration --------------------------------------------------- |
| 62 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration |
| 63 | + |
| 64 | +extensions = [ |
| 65 | + "sphinx.ext.autodoc", |
| 66 | + "sphinx.ext.intersphinx", |
| 67 | + "sphinx.ext.todo", |
| 68 | + "sphinx.ext.autosummary", |
| 69 | + "sphinx.ext.viewcode", |
| 70 | + "sphinx.ext.coverage", |
| 71 | + "sphinx.ext.doctest", |
| 72 | + "sphinx.ext.ifconfig", |
| 73 | + "sphinx.ext.mathjax", |
| 74 | + "sphinx.ext.napoleon", |
| 75 | + "myst_parser", |
| 76 | + "sphinx_rtd_theme", |
| 77 | + "sphinx-jsonschema", |
| 78 | + "frigate.sphinx.ext", |
| 79 | +] |
| 80 | + |
| 81 | +templates_path = ["_templates"] |
| 82 | +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "tests"] |
| 83 | + |
| 84 | +# -- Options for HTML output ------------------------------------------------- |
| 85 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output |
| 86 | + |
| 87 | +html_theme = "sphinx_rtd_theme" |
| 88 | +html_static_path = ["static"] |
| 89 | + |
| 90 | +source_suffix = { |
| 91 | + ".rst": "restructuredtext", |
| 92 | + ".txt": "markdown", |
| 93 | + ".md": "markdown", |
| 94 | +} |
0 commit comments