@@ -7,15 +7,16 @@ SPHINXOPTS ?=
77PAPER ?=
88
99# Internal variables.
10+ MAKEFILE_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST ) ) ) )
1011ifdef IN_NIX_SHELL
1112BIN_FOLDER = $(shell dirname "$$(command -v python ) ")
1213VENV_FOLDER = $(shell dirname "$(BIN_FOLDER ) ")
1314else
14- VENV_FOLDER = . /.venv
15+ VENV_FOLDER = $( MAKEFILE_DIR ) /.venv
1516BIN_FOLDER = $(VENV_FOLDER ) /bin
1617endif
17- DOCS_DIR = . /docs/
18- BUILDDIR = .. /_build
18+ DOCS_DIR = $( MAKEFILE_DIR ) /docs/
19+ BUILDDIR = $( MAKEFILE_DIR ) /_build
1920SPHINXBUILD = "$(realpath $(BIN_FOLDER ) /sphinx-build) "
2021SPHINXAUTOBUILD = "$(realpath $(BIN_FOLDER ) /sphinx-autobuild) "
2122PAPEROPT_a4 = -D latex_paper_size=a4
@@ -32,16 +33,23 @@ help: ## This help message
3233SPHINX ?= 8.3.2
3334PYTHON ?= python313
3435
36+ # docs contains example of custom http-example builder module
37+ export PYTHONPATH =$(DOCS_DIR )
38+
3539# environment management
3640.PHONY : dev
3741dev : # # Install required Python, create Python virtual environment, and install package requirements
42+ ifndef IN_NIX_SHELL
3843 @uv python install "$(PYTHONVERSION)"
3944 @uv venv --python "$(PYTHONVERSION)"
4045 @uv sync
46+ endif
4147
4248.PHONY : sync
4349sync : # # Sync package requirements
50+ ifndef IN_NIX_SHELL
4451 @uv sync
52+ endif
4553
4654.PHONY : init
4755init : clean clean-python dev # # Clean docs build directory and initialize Python virtual environment
@@ -84,7 +92,7 @@ show: ## Show installed packages
8492
8593.PHONY : test
8694test : # # Run tests
87- PYTHONPATH= $( DOCS_DIR ) $(BIN_FOLDER ) /pytest --cov sphinxcontrib.httpexample tests
95+ $(BIN_FOLDER ) /pytest --cov sphinxcontrib.httpexample tests
8896
8997.PHONY : devenv-%
9098devenv-% : devenv.local.nix
0 commit comments