Enable conda environment support
This commit adds conda virtual environment support for SymbiFlow docs. It also provides configuration file that allows to use conda on RTD. Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
This commit is contained in:
parent
6043723342
commit
981ef9c5b7
17
Makefile
17
Makefile
|
@ -13,7 +13,10 @@ PAPEROPT_a4 = -D latex_paper_size=a4
|
||||||
PAPEROPT_letter = -D latex_paper_size=letter
|
PAPEROPT_letter = -D latex_paper_size=letter
|
||||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||||
|
|
||||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp epub latex latexpdf text man changes linkcheck doctest
|
CONDA_DIR = build/conda
|
||||||
|
CONDA_ENV_FILE = environment.yml
|
||||||
|
|
||||||
|
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp epub latex latexpdf text man changes linkcheck doctest env
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Please use \`make <target>' where <target> is one of"
|
@echo "Please use \`make <target>' where <target> is one of"
|
||||||
|
@ -31,6 +34,7 @@ help:
|
||||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||||
@echo " linkcheck to check all external links for integrity"
|
@echo " linkcheck to check all external links for integrity"
|
||||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||||
|
@echo " env to create a conda environment with the needed packages"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -rf $(BUILDDIR)/*
|
-rm -rf $(BUILDDIR)/*
|
||||||
|
@ -111,3 +115,14 @@ doctest:
|
||||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||||
@echo "Testing of doctests in the sources finished, look at the " \
|
@echo "Testing of doctests in the sources finished, look at the " \
|
||||||
"results in $(BUILDDIR)/doctest/output.txt."
|
"results in $(BUILDDIR)/doctest/output.txt."
|
||||||
|
|
||||||
|
env:
|
||||||
|
@rm -rf $(CONDA_DIR)
|
||||||
|
@mkdir -p $(BUILDDIR) && mkdir -p $(CONDA_DIR)
|
||||||
|
@wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh\
|
||||||
|
-O $(CONDA_DIR)/miniconda.sh
|
||||||
|
@bash $(CONDA_DIR)/miniconda.sh -f -b -p $(CONDA_DIR) > /dev/null &&\
|
||||||
|
echo "Conda environment created successfully..."
|
||||||
|
@./$(CONDA_DIR)/bin/conda env create -q -f $(CONDA_ENV_FILE) > /dev/null &&\
|
||||||
|
echo "Conda packages installed successfully..."
|
||||||
|
@echo "To use conda environment type:\nsource enter-env.sh"
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ ! -n "${BASH_VERSION}" ]; then
|
||||||
|
echo "This script has to be sourced in bash!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ "${BASH_SOURCE[0]}" != "${0}" ]] && SOURCED=1 || SOURCED=0
|
||||||
|
if [ ${SOURCED} == 0 ]; then
|
||||||
|
echo "This script has to be sourced!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONDA_DIR=${PWD}/build/conda
|
||||||
|
CONDA_DIR_NAME=SymbiFlow-docs
|
||||||
|
|
||||||
|
export PATH="${CONDA_DIR}/bin:$PATH"
|
||||||
|
|
||||||
|
# Use Conda hook for user shell
|
||||||
|
SHELL_NAME=`basename $SHELL`
|
||||||
|
CONDA_HOOK_COMMAND="${CONDA_DIR}/bin/conda shell.${SHELL_NAME} hook"
|
||||||
|
eval "$(${CONDA_HOOK_COMMAND})"
|
||||||
|
|
||||||
|
conda activate ${CONDA_DIR_NAME}
|
|
@ -0,0 +1,9 @@
|
||||||
|
name: SymbiFlow-docs
|
||||||
|
channels:
|
||||||
|
- symbiflow
|
||||||
|
- conda-forge
|
||||||
|
- defaults
|
||||||
|
dependencies:
|
||||||
|
- pip
|
||||||
|
- pip:
|
||||||
|
- -r file:requirements.txt
|
|
@ -0,0 +1,20 @@
|
||||||
|
# .readthedocs.yml
|
||||||
|
# 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: source/conf.py
|
||||||
|
|
||||||
|
# Optionally build your docs in additional formats such as PDF and ePub
|
||||||
|
formats: []
|
||||||
|
|
||||||
|
# Optionally set the version of Python and requirements required to build your docs
|
||||||
|
python:
|
||||||
|
version: 3.7
|
||||||
|
|
||||||
|
conda:
|
||||||
|
environment: environment.yml
|
|
@ -1,3 +1,3 @@
|
||||||
Sphinx
|
Sphinx==2.0.0
|
||||||
git+http://github.com/SymbiFlow/sphinx_materialdesign_theme.git@master#egg=sphinx_symbiflow_theme
|
git+http://github.com/SymbiFlow/sphinx_materialdesign_theme.git@master#egg=sphinx_symbiflow_theme
|
||||||
sphinx-markdown-tables
|
sphinx-markdown-tables
|
||||||
|
|
Loading…
Reference in New Issue