Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sphinx docs #26

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4887f29
docs: Adding Sphinx quickstart config.
mithro Feb 22, 2018
4ffd365
docs: Using breathe + exhale.
mithro Feb 22, 2018
0b38bb4
docs: Update submodules on rtd.
mithro Feb 22, 2018
2e1fe08
docs: Try setting the versions.
mithro Feb 22, 2018
f429a13
docs: Adding API documentation to index.rst
mithro Feb 22, 2018
37fd6fc
docs: Lots of additions.
mithro Feb 22, 2018
8a2290f
docs: More changes to included files.
mithro Feb 22, 2018
c57fdd7
docs: Adding missing gateware subproject.
mithro Mar 4, 2018
fae9e56
docs: Don't try and install package if no setup.py
mithro Oct 28, 2018
5ab3344
docs: Ignore the 'build' directory.
mithro Oct 28, 2018
6657532
doc: Mark apidoc target as phony.
mithro Oct 28, 2018
258215a
docs: Better comments.
mithro Oct 28, 2018
90b5d93
docs: Add migen.
mithro Oct 28, 2018
84b6303
doc: At the top level to PYTHONPATH.
mithro Oct 28, 2018
1c84091
doc: Adding ability to test environment.
mithro Oct 28, 2018
160a528
docs: Clone the wiki into the docs.
mithro Oct 28, 2018
1730842
docs: Cleanup the auto apidoc generation.
mithro Oct 28, 2018
3955344
docs: Rework third_party module finding.
mithro Oct 28, 2018
756de34
doc: Ignore wiki directory.
mithro Oct 28, 2018
a89cc5d
travis+docs: Enable a "docs" build on travis.
mithro Oct 28, 2018
9b4f11b
travis+docs: Make scripts executable.
mithro Oct 28, 2018
aadfbca
travis+docs: Improve the scripts.
mithro Oct 28, 2018
e9a23c5
docs: Clone wiki with https
mithro Oct 28, 2018
a986be7
doc: Force Makefile to use a shell of bash.
mithro Oct 28, 2018
faf085c
travis+docs: Install enchant deps.
mithro Oct 28, 2018
edf08b9
docs: Use harden_xml module.
mithro Oct 28, 2018
2fcc7bf
docs: Use sphinx-contrib-exhale-multiproject
mithro Oct 28, 2018
5b37b57
docs: Use sphinx-contrib-markdown-links.
mithro Oct 28, 2018
fdacd35
travis: Package not found.
mithro Oct 28, 2018
61a27ce
docs: Disable sphinxcontrib_trio
mithro Oct 28, 2018
f1b2de7
travis+docs: Add doxygen as requirement.
mithro Oct 28, 2018
a51357d
docs: Adding inv.py to downloads.
mithro Oct 28, 2018
b125860
docs: Improve index.
mithro Oct 28, 2018
40c0a71
docs: Autostructify?
mithro Oct 28, 2018
f73b327
Fix github_doc_root.
mithro May 8, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Don't build any extra formats
formats:
- htmlzip

requirements_file: doc/requirements.txt

build:
image: latest

python:
version: 3
11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ addons:
update: true
packages:
- build-essential
- doxygen
- fxload
- gnupg
- libenchant-dev
- libftdi-dev
- libreadline-dev
- libusb-1.0-0-dev
Expand All @@ -27,23 +29,28 @@ install:
- export PLATFORMS="$P" && echo "PLATFORMS='$PLATFORMS'"
- export TARGETS="$T" && echo "TARGETS='$TARGETS'"
- export FIRMWARE="$F" && echo "FIRMWARE='$FIRMWARE'"
- $PWD/.travis/setup.sh
- $PWD/.travis/setup-$SCRIPT.sh

script:
- $PWD/.travis/build.sh
- $PWD/.travis/$SCRIPT.sh

after_success:
- $PWD/.travis/update-prebuilt-list.sh

env:
global:
- SCRIPT=build
- HDMI2USB_UDEV_IGNORE=1
- CLEAN_CHECK=1
- PREBUILT_DIR="/tmp/HDMI2USB-firmware-prebuilt"
# Travis reports incorrect the hosts number of processors, override to 2
# cores.
- JOBS=2
matrix:
#--------------------------------------------
# Non-firmware building targets
#--------------------------------------------
- SCRIPT=docs
#--------------------------------------------
# Base targets
#--------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions .travis/docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/bash

set -x
set -e

cd doc
make html
File renamed without changes.
9 changes: 9 additions & 0 deletions .travis/setup-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/bash

set -x
set -e

cd doc
make testenv
make wiki
make apidoc
8 changes: 8 additions & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.Makefile.d
_build
_doxygen
_venv
tools
*-api
apidoc
wiki
124 changes: 124 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Minimal makefile for Sphinx documentation

# Use the "source" keyword which only works in bash?
SHELL := /bin/bash

# Disable make's inbuilt rules
.SUFFIXES:

# You can set these variables from the command line.
TOPDIR = $(realpath ..)
BUILDDIR = _build
VENV_ROOT = $(BUILDDIR)/_venv
SPHINXOPTS =
SPHINXBUILD = $(VENV_ROOT)/bin/sphinx-build
SPHINXPROJ = LiteXBuildEnvironment
SOURCEDIR = .

THIRD_PARTY_MODDIRS = $(dir $(wildcard $(TOPDIR)/third_party/*/setup.py))
THIRD_PARTY_MODULES = $(notdir $(patsubst %/,%,$(THIRD_PARTY_MODDIRS)))

# Put it first so that "make" without argument is like "make help".
#-------------------------------------------
help: $(SPHINXBUILD)
@$(SPHINXRUN) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help

# Set up a virtualenv
#-------------------------------------------
$(VENV_ROOT):
mkdir -p $<

PYTHONPATH = $(TOPDIR)
export PYTHONPATH

$(VENV_ROOT)/bin/activate:
virtualenv -p python3 $(VENV_ROOT)

ACTIVATE = source $(VENV_ROOT)/bin/activate


# Install the requirements into the virtualenv
#-------------------------------------------

$(VENV_ROOT)/requirements.stamp: requirements.txt $(VENV_ROOT)/bin/activate | $(VENV_ROOT)
$(ACTIVATE); pip install -r requirements.txt
@touch $(VENV_ROOT)/requirements.stamp

$(VENV_ROOT)/third_party.stamp: $(VENV_ROOT)/bin/activate | $(VENV_ROOT)
$(ACTIVATE); for MODDIR in $(THIRD_PARTY_MODDIRS); do \
pip install $$MODDIR; \
done
@touch $(VENV_ROOT)/third_party.stamp

$(SPHINXBUILD): $(VENV_ROOT)/requirements.stamp $(VENV_ROOT)/third_party.stamp
@touch $<

distclean:
rm -rf _build $(VENV_ROOT) .Makefile.d
mkdir -p _build
mkdir -p $(VENV_ROOT)

clean:
rm -rf _doxygen verilog
@$(ACTIVATE); $(SPHINXRUN) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

testenv:
@$(ACTIVATE); $(VENV_ROOT)/bin/python3 -c "import sys; print(sys.path)"
@# Test the import of third_party python libraries
@$(ACTIVATE); for MODULE in $(THIRD_PARTY_MODULES); do \
python -c "import $$MODULE; print($$MODULE)"; \
done
@# Test the import of top level gateware module
@$(ACTIVATE); $(VENV_ROOT)/bin/python3 -c "import gateware; print(gateware)"

SPHINXRUN = $(ACTIVATE); $(VENV_ROOT)/bin/python3 $(VENV_ROOT)/bin/sphinx-build

.PHONY: distclean clean

# Generate targets for all the other sphinx commands.
#-------------------------------------------
SPHINXCMD = $(SPHINXRUN) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
SPHINXSUBCMD = $(SPHINXRUN) -M $$@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.Makefile.d: $(SPHINXBUILD) Makefile
mkdir -p _doxygen
$(SPHINXRUN) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \
| grep "^ " \
| sed -e's/^ \+//' -e's|^\([^ ]*\) \+.*$$|\1: $(SPHINXBUILD)\n\t$(SPHINXSUBCMD)\n\n.PHONY: \1\n\n|' \
> .Makefile.d

-include .Makefile.d

# Get the intersphinx inventory files.
#-------------------------------------------
inv:
@mkdir -p _build/intersphinx/
@./inv.py

.PHONY: inv

# Wiki Documentation
#--------------------------------------------
wiki:
if [ ! -d wiki ]; then \
git clone https://github.com/timvideos/litex-buildenv.wiki.git wiki; \
else \
cd wiki; git pull; \
fi

.PHONY: wiki

# Use sphinx-apidoc to auto-extract docstring
#--------------------------------------------
SPHINX_APIDOC = --follow-links --separate --module-first --append-syspath
apidoc:
rm -rf apidoc
# Top level like "gateware" and similar
$(ACTIVATE); sphinx-apidoc $(SPHINX_APIDOC) -e -o apidoc/litex-buildenv ../ ../third_party ../doc ../build
@$(ACTIVATE); for MODULE in $(THIRD_PARTY_MODULES); do \
sphinx-apidoc $(SPHINX_APIDOC) -o apidoc/third_party/$$MODULE ../third_party/$$MODULE/$$MODULE; \
done

.PHONY: apidoc
Loading