Skip to content

Commit 945f81b

Browse files
committed
Fix to disable uv sync when in nix shell
1 parent 1a96d9a commit 945f81b

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ SPHINXOPTS ?=
77
PAPER ?=
88

99
# Internal variables.
10+
MAKEFILE_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
1011
ifdef IN_NIX_SHELL
1112
BIN_FOLDER = $(shell dirname "$$(command -v python)")
1213
VENV_FOLDER = $(shell dirname "$(BIN_FOLDER)")
1314
else
14-
VENV_FOLDER = ./.venv
15+
VENV_FOLDER = $(MAKEFILE_DIR)/.venv
1516
BIN_FOLDER = $(VENV_FOLDER)/bin
1617
endif
17-
DOCS_DIR = ./docs/
18-
BUILDDIR = ../_build
18+
DOCS_DIR = $(MAKEFILE_DIR)/docs/
19+
BUILDDIR = $(MAKEFILE_DIR)/_build
1920
SPHINXBUILD = "$(realpath $(BIN_FOLDER)/sphinx-build)"
2021
SPHINXAUTOBUILD = "$(realpath $(BIN_FOLDER)/sphinx-autobuild)"
2122
PAPEROPT_a4 = -D latex_paper_size=a4
@@ -32,16 +33,23 @@ help: ## This help message
3233
SPHINX ?= 8.3.2
3334
PYTHON ?= python313
3435

36+
# docs contains example of custom http-example builder module
37+
export PYTHONPATH=$(DOCS_DIR)
38+
3539
# environment management
3640
.PHONY: dev
3741
dev: ## 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
4349
sync: ## Sync package requirements
50+
ifndef IN_NIX_SHELL
4451
@uv sync
52+
endif
4553

4654
.PHONY: init
4755
init: 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
8694
test: ## 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-%
9098
devenv-%: devenv.local.nix

0 commit comments

Comments
 (0)