From 3a4d5b05304d45b781c9fcad22c492b5e8d623e6 Mon Sep 17 00:00:00 2001 From: Mark Elliot <123787712+mark-thm@users.noreply.github.com> Date: Mon, 17 Jun 2024 13:33:55 -0400 Subject: [PATCH 1/2] Use --python arg instead of PATH munging --- uv/private/pip.bzl | 4 ++-- uv/private/pip_compile.sh | 4 ---- uv/private/pip_compile_test.sh | 4 ---- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/uv/private/pip.bzl b/uv/private/pip.bzl index d661a51..87e8807 100644 --- a/uv/private/pip.bzl +++ b/uv/private/pip.bzl @@ -35,7 +35,8 @@ def _uv_pip_compile( args = [] args += uv_args args.append("--custom-compile-command='{compile_command}'".format(compile_command = compile_command)) - args.append("--python-version={version}".format(version = _python_version(py_toolchain))) + args.append("--python={python}".format(python = _python_version(py_toolchain))) + args.append("--python-version={version}".format(version = py_toolchain.py3_runtime.interpreter.short_path)) if ctx.attr.python_platform: args.append("--python-platform={platform}".format(platform = ctx.attr.python_platform)) @@ -48,7 +49,6 @@ def _uv_pip_compile( "{{requirements_in}}": ctx.file.requirements_in.short_path, "{{requirements_txt}}": ctx.file.requirements_txt.short_path, "{{compile_command}}": compile_command, - "{{resolved_python}}": py_toolchain.py3_runtime.interpreter.short_path, }, ) diff --git a/uv/private/pip_compile.sh b/uv/private/pip_compile.sh index 381ec21..63b8a6d 100644 --- a/uv/private/pip_compile.sh +++ b/uv/private/pip_compile.sh @@ -6,10 +6,6 @@ set -euo pipefail REQUIREMENTS_IN="{{requirements_in}}" REQUIREMENTS_TXT="{{requirements_txt}}" -# set resolved python to front of the path -RESOLVED_PYTHON_BIN="$(dirname "{{resolved_python}}")" -export PATH="$RESOLVED_PYTHON_BIN:$PATH" - {{uv}} pip compile \ {{args}} \ --output-file="$REQUIREMENTS_TXT" \ diff --git a/uv/private/pip_compile_test.sh b/uv/private/pip_compile_test.sh index 8e9102f..e63d6ae 100644 --- a/uv/private/pip_compile_test.sh +++ b/uv/private/pip_compile_test.sh @@ -7,10 +7,6 @@ REQUIREMENTS_IN="{{requirements_in}}" REQUIREMENTS_TXT="{{requirements_txt}}" COMPILE_COMMAND="{{compile_command}}" -# set resolved python to front of the path -RESOLVED_PYTHON_BIN="$(dirname "{{resolved_python}}")" -export PATH="$RESOLVED_PYTHON_BIN:$PATH" - # make a writable copy of incoming requirements cp "$REQUIREMENTS_TXT" __updated__ From 5777b4c15a4c2f4c8b96dd71a6f7186b44aa9515 Mon Sep 17 00:00:00 2001 From: Mark Elliot <123787712+mark-thm@users.noreply.github.com> Date: Mon, 17 Jun 2024 13:35:17 -0400 Subject: [PATCH 2/2] oops --- uv/private/pip.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uv/private/pip.bzl b/uv/private/pip.bzl index 87e8807..cf832bb 100644 --- a/uv/private/pip.bzl +++ b/uv/private/pip.bzl @@ -35,8 +35,8 @@ def _uv_pip_compile( args = [] args += uv_args args.append("--custom-compile-command='{compile_command}'".format(compile_command = compile_command)) - args.append("--python={python}".format(python = _python_version(py_toolchain))) - args.append("--python-version={version}".format(version = py_toolchain.py3_runtime.interpreter.short_path)) + args.append("--python={python}".format(python = py_toolchain.py3_runtime.interpreter.short_path)) + args.append("--python-version={version}".format(version = _python_version(py_toolchain))) if ctx.attr.python_platform: args.append("--python-platform={platform}".format(platform = ctx.attr.python_platform))