Skip to content

Commit a746817

Browse files
committed
Fix UV_PYTHON default value to prevent empty parameter error
The UV_PYTHON setting had an empty default in metadata, causing uv venv to fail with "a value is required for '--python <PYTHON>'". Fixed by setting UV_PYTHON default to $(PRIMARY_PYTHON) in mxenv.mk metadata and updating test expectations.
1 parent 7e12bd8 commit a746817

File tree

5 files changed

+8
-17
lines changed

5 files changed

+8
-17
lines changed

Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ PYTHON_PACKAGE_INSTALLER?=uv
6868
# environments with global UV. Passed to `uv venv -p VALUE`. Supports version
6969
# specs like `3.11`, `3.14`, `cpython@3.14`. Defaults to PRIMARY_PYTHON value
7070
# for backward compatibility.
71-
# No default value.
72-
UV_PYTHON?=
71+
# Default: $(PRIMARY_PYTHON)
72+
UV_PYTHON?=$(PRIMARY_PYTHON)
7373

7474
# Flag whether to use virtual environment. If `false`, the
7575
# interpreter according to `PRIMARY_PYTHON` found in `PATH` is used.
@@ -252,9 +252,6 @@ endif
252252
USE_GLOBAL_UV:=$(shell [[ "$(PYTHON_PACKAGE_INSTALLER)" == "uv" && "$(UV_AVAILABLE)" == "true" ]] && echo "true" || echo "false")
253253
USE_LOCAL_UV:=$(shell [[ "$(PYTHON_PACKAGE_INSTALLER)" == "uv" && "$(UV_AVAILABLE)" == "false" ]] && echo "true" || echo "false")
254254

255-
# UV Python version (defaults to PRIMARY_PYTHON for backward compatibility)
256-
UV_PYTHON?=$(PRIMARY_PYTHON)
257-
258255
# Check if global UV is outdated (non-blocking warning)
259256
ifeq ("$(USE_GLOBAL_UV)","true")
260257
UV_OUTDATED:=$(shell uv self update --dry-run 2>&1 | grep -q "Would update" && echo "true" || echo "false")

src/mxmake/tests/expected/Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ PYTHON_PACKAGE_INSTALLER?=pip
5959
# environments with global UV. Passed to `uv venv -p VALUE`. Supports version
6060
# specs like `3.11`, `3.14`, `cpython@3.14`. Defaults to PRIMARY_PYTHON value
6161
# for backward compatibility.
62-
# No default value.
63-
UV_PYTHON?=
62+
# Default: $(PRIMARY_PYTHON)
63+
UV_PYTHON?=$(PRIMARY_PYTHON)
6464

6565
# Flag whether to use virtual environment. If `false`, the
6666
# interpreter according to `PRIMARY_PYTHON` found in `PATH` is used.
@@ -158,9 +158,6 @@ endif
158158
USE_GLOBAL_UV:=$(shell [[ "$(PYTHON_PACKAGE_INSTALLER)" == "uv" && "$(UV_AVAILABLE)" == "true" ]] && echo "true" || echo "false")
159159
USE_LOCAL_UV:=$(shell [[ "$(PYTHON_PACKAGE_INSTALLER)" == "uv" && "$(UV_AVAILABLE)" == "false" ]] && echo "true" || echo "false")
160160

161-
# UV Python version (defaults to PRIMARY_PYTHON for backward compatibility)
162-
UV_PYTHON?=$(PRIMARY_PYTHON)
163-
164161
# Check if global UV is outdated (non-blocking warning)
165162
ifeq ("$(USE_GLOBAL_UV)","true")
166163
UV_OUTDATED:=$(shell uv self update --dry-run 2>&1 | grep -q "Would update" && echo "true" || echo "false")

src/mxmake/tests/test_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_MakefileParser(self, tempdir):
2121
"core.mxenv.PRIMARY_PYTHON": "python3",
2222
"core.mxenv.PYTHON_MIN_VERSION": "3.7",
2323
"core.mxenv.PYTHON_PACKAGE_INSTALLER": "pip",
24-
"core.mxenv.UV_PYTHON": "",
24+
"core.mxenv.UV_PYTHON": "$(PRIMARY_PYTHON)",
2525
"core.mxenv.VENV_ENABLED": "true",
2626
"core.mxenv.VENV_CREATE": "true",
2727
"core.mxenv.VENV_FOLDER": "venv",
@@ -67,7 +67,7 @@ def test_MakefileParser(self, tempdir):
6767
"core.mxenv.PRIMARY_PYTHON": "python3",
6868
"core.mxenv.PYTHON_MIN_VERSION": "3.7",
6969
"core.mxenv.PYTHON_PACKAGE_INSTALLER": "pip",
70-
"core.mxenv.UV_PYTHON": "",
70+
"core.mxenv.UV_PYTHON": "$(PRIMARY_PYTHON)",
7171
"core.mxenv.VENV_ENABLED": "true",
7272
"core.mxenv.VENV_CREATE": "true",
7373
"core.mxenv.VENV_FOLDER": "venv",

src/mxmake/tests/test_templates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ def test_Makefile(self, tempdir):
564564
"core.mxenv.PRIMARY_PYTHON": "python3",
565565
"core.mxenv.PYTHON_MIN_VERSION": "3.9",
566566
"core.mxenv.PYTHON_PACKAGE_INSTALLER": "pip",
567-
"core.mxenv.UV_PYTHON": "",
567+
"core.mxenv.UV_PYTHON": "$(PRIMARY_PYTHON)",
568568
"core.mxenv.VENV_ENABLED": "true",
569569
"core.mxenv.VENV_CREATE": "true",
570570
"core.mxenv.VENV_FOLDER": ".venv",

src/mxmake/topics/core/mxenv.mk

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#: environments with global UV. Passed to `uv venv -p VALUE`. Supports version
4747
#: specs like `3.11`, `3.14`, `cpython@3.14`. Defaults to PRIMARY_PYTHON value
4848
#: for backward compatibility.
49-
#:default =
49+
#:default = $(PRIMARY_PYTHON)
5050
#:
5151
#:[setting.VENV_ENABLED]
5252
#:description = Flag whether to use virtual environment. If `false`, the
@@ -113,9 +113,6 @@ endif
113113
USE_GLOBAL_UV:=$(shell [[ "$(PYTHON_PACKAGE_INSTALLER)" == "uv" && "$(UV_AVAILABLE)" == "true" ]] && echo "true" || echo "false")
114114
USE_LOCAL_UV:=$(shell [[ "$(PYTHON_PACKAGE_INSTALLER)" == "uv" && "$(UV_AVAILABLE)" == "false" ]] && echo "true" || echo "false")
115115

116-
# UV Python version (defaults to PRIMARY_PYTHON for backward compatibility)
117-
UV_PYTHON?=$(PRIMARY_PYTHON)
118-
119116
# Check if global UV is outdated (non-blocking warning)
120117
ifeq ("$(USE_GLOBAL_UV)","true")
121118
UV_OUTDATED:=$(shell uv self update --dry-run 2>&1 | grep -q "Would update" && echo "true" || echo "false")

0 commit comments

Comments
 (0)