From 194fbd72f0b6430fb841d0f91a9a08f11c8c2f91 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Fri, 6 May 2022 08:34:46 +0200 Subject: [PATCH 1/2] Update the `venv` command in the Makefile. --- Makefile | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 38b476628..cb2951fa0 100644 --- a/Makefile +++ b/Makefile @@ -3,21 +3,23 @@ # You can set these variables from the command line. PYTHON = python3 +VENVDIR = ./venv +BUILDDIR = _build SPHINXOPTS = -SPHINXBUILD = ./venv/bin/sphinx-build +SPHINXBUILD = $(VENVDIR)/bin/sphinx-build PAPER = -BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp \ +.PHONY: help venv clean html dirhtml singlehtml pickle json htmlhelp qthelp \ devhelp epub latex latexpdf text man changes linkcheck doctest htmlview check help: @echo "Please use \`make ' where is one of" + @echo " venv to create a venv with necessary tools" @echo " html to make standalone HTML files" @echo " htmlview to open the index page built by the html target in your browser" @echo " dirhtml to make HTML files named index.html in directories" @@ -41,9 +43,15 @@ clean: -rm -rf $(BUILDDIR)/* venv: - $(PYTHON) -m venv venv - ./venv/bin/python3 -m pip install --upgrade pip - ./venv/bin/python3 -m pip install -r requirements.txt + @if [ -d $(VENVDIR) ] ; then \ + echo "venv already exists."; \ + echo "To recreate it, remove it first with \`make clean-venv'."; \ + else \ + $(PYTHON) -m venv $(VENVDIR); \ + $(VENVDIR)/bin/python3 -m pip install --upgrade pip; \ + $(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \ + echo "The venv has been created in the $(VENVDIR) directory"; \ + fi html: venv $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html From c931962174b8e3c0a547bc0aadee006468c37c58 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Fri, 6 May 2022 08:35:17 +0200 Subject: [PATCH 2/2] Add the `clean-env` and updated the `clean` command. --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cb2951fa0..e0e6ecd73 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,7 @@ help: @echo " venv to create a venv with necessary tools" @echo " html to make standalone HTML files" @echo " htmlview to open the index page built by the html target in your browser" + @echo " clean to remove the venv and build files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @@ -39,9 +40,12 @@ help: @echo " doctest to run all doctests embedded in the documentation (if enabled)" @echo " check to run a check for frequent markup errors" -clean: +clean: clean-venv -rm -rf $(BUILDDIR)/* +clean-venv: + rm -rf $(VENVDIR) + venv: @if [ -d $(VENVDIR) ] ; then \ echo "venv already exists."; \