From fdcb3a71bee69b51df0346dac57d2f0e7d1a362f Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Fri, 23 Apr 2021 18:42:54 +0200 Subject: [PATCH] added readthedocs --- .readthedocs.yaml | 15 ++++++++ generate-docs.sh | 13 +++++++ sphinx-docs/.gitignore | 3 ++ sphinx-docs/Makefile | 20 +++++++++++ sphinx-docs/make.bat | 35 +++++++++++++++++++ sphinx-docs/source/conf.py | 66 ++++++++++++++++++++++++++++++++++++ sphinx-docs/source/index.rst | 30 ++++++++++++++++ 7 files changed, 182 insertions(+) create mode 100644 generate-docs.sh create mode 100644 sphinx-docs/Makefile create mode 100644 sphinx-docs/make.bat create mode 100644 sphinx-docs/source/conf.py create mode 100644 sphinx-docs/source/index.rst diff --git a/.readthedocs.yaml b/.readthedocs.yaml index e69de29..19dfbd7 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -0,0 +1,15 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: sphinx-docs/source/conf.py + +# Optionally set the version of Python and requirements required to build your docs +python: + version: 3.7 + system_packages: true diff --git a/generate-docs.sh b/generate-docs.sh new file mode 100644 index 0000000..b0b76df --- /dev/null +++ b/generate-docs.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +source venv/bin/activate + +pip install sphinx + +PYTHONPATH=. sphinx-apidoc -e -f -o sphinx-docs/source riscemu riscemu/colors.py riscemu/__main__.py + +cd sphinx-docs + +make html + +# xdg-open build/html/index.html \ No newline at end of file diff --git a/sphinx-docs/.gitignore b/sphinx-docs/.gitignore index e69de29..4b8fab5 100644 --- a/sphinx-docs/.gitignore +++ b/sphinx-docs/.gitignore @@ -0,0 +1,3 @@ +build +source/riscemu*.rst +source/modules.rst \ No newline at end of file diff --git a/sphinx-docs/Makefile b/sphinx-docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/sphinx-docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/sphinx-docs/make.bat b/sphinx-docs/make.bat new file mode 100644 index 0000000..6247f7e --- /dev/null +++ b/sphinx-docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/sphinx-docs/source/conf.py b/sphinx-docs/source/conf.py new file mode 100644 index 0000000..033075a --- /dev/null +++ b/sphinx-docs/source/conf.py @@ -0,0 +1,66 @@ +import os, sys +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'RiscEmu' +copyright = '2021, Anton Lydike' +author = 'Anton Lydike' + +# The full version, including alpha/beta/rc tags +release = '0.1.0' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc' +] + +# autodoc options +autodoc_default_options = { + 'members': True, + 'member-order': 'bysource', + 'special-members': '__init__', +} + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +sys.path.insert(0, os.path.abspath('../../')) diff --git a/sphinx-docs/source/index.rst b/sphinx-docs/source/index.rst new file mode 100644 index 0000000..f7c63bf --- /dev/null +++ b/sphinx-docs/source/index.rst @@ -0,0 +1,30 @@ +.. RiscEmu documentation master file, created by + sphinx-quickstart on Thu Apr 22 14:39:35 2021. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +RiscEmu Documentation! +=================================== + +Check this project out on github_. + +.. _github: https://github.com/antonlydike/riscemu + + +Package structure: +================= + +.. toctree:: + :maxdepth: 5 + + riscemu + + +Other links: +============ + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + +