Skip to content

Commit 4564af5

Browse files
committed
update command to be more readable if not overridden
1 parent be0a953 commit 4564af5

File tree

2 files changed

+182
-174
lines changed

2 files changed

+182
-174
lines changed

Makefile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
#* Variables
22
SHELL ?= /usr/bin/env bash
3-
PYTHON_PATH = $(shell which python)
4-
PYTHON_ROOT := $(dir $(PYTHON_PATH))
3+
54
# use the directory rather than the python binary to allow auto-discovery, which is more cross-platform compatible
6-
UV_PYTHON_PATH ?= $(UV_PYTHON_ROOT)
5+
PYTHON_PATH := $(shell which python)
6+
PYTHON_ROOT := $(shell dirname $(dir $(PYTHON_PATH)))
7+
UV_PYTHON_ROOT ?= $(PYTHON_ROOT)
8+
79
# to actually reuse an existing virtual/conda environment, the 'UV_PROJECT_ENVIRONMENT' variable must be set to it
810
# use this command:
911
# UV_PROJECT_ENVIRONMENT=/path/to/env make [target]
1012
# consider exporting this variable in '/path/to/env/etc/conda/activate.d/env.sh' to enable it by default when
1113
# activating a conda environment, and reset it in '/path/to/env/etc/conda/deactivate.d/env.sh'
12-
UV_PROJECT_ENVIRONMENT ?= .venv
14+
UV_PROJECT_ENVIRONMENT ?=
1315
# make sure every uv command employs the specified environment path
14-
UV_COMMAND ?= UV_PROJECT_ENVIRONMENT="$(UV_PROJECT_ENVIRONMENT)" uv
16+
ifeq (${UV_PROJECT_ENVIRONMENT},)
17+
UV_COMMAND := uv
18+
else
19+
UV_COMMAND := UV_PROJECT_ENVIRONMENT="${UV_PROJECT_ENVIRONMENT}" uv
20+
endif
1521

1622
#* UV
1723
.PHONY: setup

0 commit comments

Comments
 (0)