From 317d106b9cf4da56fb042f8428af2ce193b671cd Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Fri, 23 Apr 2021 19:02:33 +0200 Subject: [PATCH] lots of readthedocs debugging --- generate-docs.sh | 15 +++++++++++++-- sphinx-docs/source/conf.py | 8 +++++++- sphinx.py | 0 3 files changed, 20 insertions(+), 3 deletions(-) mode change 100644 => 100755 generate-docs.sh delete mode 100644 sphinx.py diff --git a/generate-docs.sh b/generate-docs.sh old mode 100644 new mode 100755 index b0b76df..e3c9632 --- a/generate-docs.sh +++ b/generate-docs.sh @@ -1,8 +1,19 @@ #!/usr/bin/env bash +# super hacky script to generate documentation when developing and for readthedocs -source venv/bin/activate +echo "Generating docs!" -pip install sphinx +if command -v 'sphinx-apidoc' >/dev/null; then + source venv/bin/activate + pip install sphinx +fi + +if [[ $1 == 'generate' ]]; then + + PYTHONPATH=../../ sphinx-apidoc -e -f -o . ../../riscemu ../../riscemu/colors.py ../../riscemu/__main__.py + echo "only generating, not building..." + exit 0 +fi PYTHONPATH=. sphinx-apidoc -e -f -o sphinx-docs/source riscemu riscemu/colors.py riscemu/__main__.py diff --git a/sphinx-docs/source/conf.py b/sphinx-docs/source/conf.py index 033075a..96a296a 100644 --- a/sphinx-docs/source/conf.py +++ b/sphinx-docs/source/conf.py @@ -1,4 +1,7 @@ -import os, sys +import os +import sys +import subprocess + # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full @@ -15,6 +18,9 @@ import os, sys # import sys # sys.path.insert(0, os.path.abspath('.')) +if os.getenv('READTHEDOCS', False) and not os.path.exists('riscemu.rst'): + subprocess.check_call(['../../generate-docs.sh', 'generate']) + # -- Project information ----------------------------------------------------- diff --git a/sphinx.py b/sphinx.py deleted file mode 100644 index e69de29..0000000