Skip to content

Commit 8310938

Browse files
committed
Activate venvs for relevant commands
Since each command in a recipe runs in a separate shell, activating a venv has no effect on subsequent commands. This fixes that by running venv-relative commands in the same recipe "line". While we're at it, make docs the default target, and ensure that the requirements are installed before attempting to run mkdocs. Signed-off-by: Stephen Kitt <[email protected]>
1 parent 0204d7e commit 8310938

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Makefile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,26 @@
1313
# limitations under the License.
1414
SHELL := /bin/bash
1515

16+
all: docs
17+
1618
# Install dependencies
1719
.PHONY: install
1820
install:
1921
# Create python virtual environment
2022
python3 -m venv venv/
2123

22-
# Active virtual environment
23-
source ./venv/bin/activate
24-
25-
# Install python depdendencies
26-
pip install -r requirements.txt
24+
# Activate virtual environment and install dependencies
25+
source ./venv/bin/activate && pip install -r requirements.txt
2726

2827

29-
# Build the documentation.
28+
# Build the documentation
3029
.PHONY: docs
31-
docs:
30+
docs: install
3231
# Ensure site dir exists
3332
mkdir -p site
3433

3534
# Generate docs with mkdocs
36-
mkdocs build
35+
source ./venv/bin/activate && mkdocs build
3736

3837

3938
# Cleanup local directory

0 commit comments

Comments
 (0)