aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/python/conf.py
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-06-21 18:50:55 +0200
committerDavid Robillard <d@drobilla.net>2022-01-28 22:21:07 -0500
commitccbbd538d001ae4e17c86839b0583716e0dd3527 (patch)
tree5d55f82f617171bb34199484c21f7ec6c50f28d9 /bindings/python/conf.py
parentcb9bc60bfd95173ead26540714dc682842cad80b (diff)
downloadserd-ccbbd538d001ae4e17c86839b0583716e0dd3527.tar.gz
serd-ccbbd538d001ae4e17c86839b0583716e0dd3527.tar.bz2
serd-ccbbd538d001ae4e17c86839b0583716e0dd3527.zip
[WIP] Add Python bindings
Diffstat (limited to 'bindings/python/conf.py')
-rw-r--r--bindings/python/conf.py120
1 files changed, 120 insertions, 0 deletions
diff --git a/bindings/python/conf.py b/bindings/python/conf.py
new file mode 100644
index 00000000..f145d217
--- /dev/null
+++ b/bindings/python/conf.py
@@ -0,0 +1,120 @@
+import os
+import sys
+
+
+from unittest.mock import Mock as MagicMock
+
+sys.path.insert(0, os.path.abspath("../../build/bindings/python"))
+
+
+class Mock(MagicMock):
+ @classmethod
+ def __getattr__(cls, name):
+ return MagicMock()
+
+
+MOCK_MODULES = ["cython", "libc.stdint"]
+sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
+
+
+# Project information
+
+project = "Serd"
+copyright = "2021, David Robillard"
+author = "David Robillard"
+release = "0.0.0" # FIXME
+
+
+# General configuration
+
+exclude_patterns = ["xml", "_build", "Thumbs.db", ".DS_Store"]
+language = "en"
+nitpicky = True
+pygments_style = "friendly"
+
+extensions = [
+ "sphinx.ext.autodoc",
+ "sphinx.ext.doctest",
+]
+
+# Ignore everything opaque or external for nitpicky mode
+_opaque = [
+ "serd._SinkBase",
+ "serd.__ByteSource",
+ "unicode",
+]
+
+nitpick_ignore = list(map(lambda x: ("py:class", x), _opaque))
+
+# HTML output
+
+try:
+ import sphinx_lv2_theme
+
+ have_lv2_theme = True
+except ModuleNotFoundError:
+ have_lv2_theme = False
+
+html_copy_source = False
+html_short_title = "Serd"
+html_static_path = ["_static"]
+html_theme = "sphinx_lv2_theme"
+
+if have_lv2_theme:
+ html_theme = "sphinx_lv2_theme"
+
+ if tags.has("singlehtml"):
+ html_sidebars = {
+ "**": [
+ "globaltoc.html",
+ ]
+ }
+
+ html_theme_options = {
+ "body_max_width": "48em",
+ "body_min_width": "48em",
+ "description": "A lightweight library for working with RDF",
+ "show_footer_version": True,
+ "show_logo_version": False,
+ "logo": "serd.svg",
+ "logo_name": True,
+ "logo_width": "8em",
+ "nosidebar": False,
+ "page_width": "80em",
+ "sidebar_width": "18em",
+ "globaltoc_maxdepth": 3,
+ "globaltoc_collapse": False,
+ }
+
+ else:
+ html_theme_options = {
+ "body_max_width": "60em",
+ "body_min_width": "40em",
+ "description": "A lightweight library for working with RDF",
+ "show_footer_version": True,
+ "show_logo_version": False,
+ "logo": "serd.svg",
+ "logo_name": True,
+ "logo_width": "8em",
+ "nosidebar": True,
+ "page_width": "60em",
+ "sidebar_width": "14em",
+ "globaltoc_maxdepth": 1,
+ "globaltoc_collapse": True,
+ }
+
+else:
+
+ html_theme = "alabaster"
+
+ html_theme_options = {
+ "body_max_width": "60em",
+ "body_min_width": "40em",
+ "description": "A lightweight library for working with RDF",
+ "logo": "serd.svg",
+ "logo_name": True,
+ "page_width": "60em",
+ "sidebar_width": "14em",
+ "globaltoc_maxdepth": 1,
+ "globaltoc_collapse": True,
+ }