From 1a2ee6f4725fd82249347152c0447a1e35928123 Mon Sep 17 00:00:00 2001 From: Robert Winkler Date: Thu, 10 Sep 2020 19:24:49 +0200 Subject: [PATCH 1/3] Add make-env submodule Signed-off-by: Robert Winkler --- .gitmodules | 3 +++ third_party/make-env | 1 + 2 files changed, 4 insertions(+) create mode 160000 third_party/make-env diff --git a/.gitmodules b/.gitmodules index 0dcbfef..c13cdb4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -15,3 +15,6 @@ [submodule "source/vtr-verilog-to-routing"] path = source/vtr-verilog-to-routing url = ../vtr-verilog-to-routing +[submodule "third_party/make-env"] + path = third_party/make-env + url = https://github.com/SymbiFlow/make-env/ diff --git a/third_party/make-env b/third_party/make-env new file mode 160000 index 0000000..0696632 --- /dev/null +++ b/third_party/make-env @@ -0,0 +1 @@ +Subproject commit 069663287b59b07e67c15fc88ec9faf850ca1580 From b5322a95aad40429c766fe72fc0dc1966b3cc20b Mon Sep 17 00:00:00 2001 From: Robert Winkler Date: Thu, 10 Sep 2020 19:25:58 +0200 Subject: [PATCH 2/3] Setup build environment using make-env Signed-off-by: Robert Winkler --- .gitignore | 1 + Makefile | 35 +++++++++++++++-------------------- enter-env.sh | 24 ------------------------ environment.yml | 2 +- 4 files changed, 17 insertions(+), 45 deletions(-) delete mode 100644 enter-env.sh diff --git a/.gitignore b/.gitignore index 17a02b0..031df4e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build/ +env/ *.pyc *.sw* diff --git a/Makefile b/Makefile index ed05fc0..2224752 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,18 @@ -# Makefile for Sphinx documentation +# make-env setup ------------------------------------------------------------- + +TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) + +# A pip `requirements.txt` file. +# https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format +REQUIREMENTS_FILE := requirements.txt # +# A conda `environment.yml` file. +# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html +ENVIRONMENT_FILE := environment.yml + +include third_party/make-env/conda.mk + +# Makefile for Sphinx documentation ------------------------------------------ # You can set these variables from the command line. SPHINXOPTS = @@ -12,9 +25,6 @@ PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source -CONDA_DIR = build/conda -CONDA_ENV_FILE = environment.yml - DOXYGEN_DIR = build/doxygen .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp epub latex latexpdf text man changes linkcheck doctest env @@ -36,9 +46,8 @@ help: @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" @echo " env to create a conda environment with the needed packages" - @echo " env-clean to remove the conda environment" -clean: +clean:: -rm -rf $(BUILDDIR)/ -rm -rf $(DOXYGEN_DIR)/ @@ -118,17 +127,3 @@ doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." - -env: - @rm -rf $(CONDA_DIR) - @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" - -env-clean: - @rm -rf $(CONDA_DIR) diff --git a/enter-env.sh b/enter-env.sh deleted file mode 100644 index ed45947..0000000 --- a/enter-env.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/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} diff --git a/environment.yml b/environment.yml index f7ff1d6..18ebf2a 100644 --- a/environment.yml +++ b/environment.yml @@ -1,4 +1,4 @@ -name: SymbiFlow-docs +name: symbiflow-docs channels: - symbiflow - conda-forge From dd6660a4601ef5d29ae8d0983c1a2559ee015c9c Mon Sep 17 00:00:00 2001 From: Robert Winkler Date: Wed, 16 Sep 2020 15:51:54 +0200 Subject: [PATCH 3/3] Update README after setting make-env Signed-off-by: Robert Winkler --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index f0c4a2b..2248fe1 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,7 @@ Building documentation Activate the virtual environment and install dependencies:: make env - source enter-env.sh + make enter Build the whole documentation::