From 7cf87877be70cfd306a9c0d822dc904ec82f7f7d Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Thu, 21 Dec 2023 17:30:24 +0900 Subject: [PATCH] do the interpreter symlink resolution everywhere --- python/pip_install/pip_repository.bzl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/python/pip_install/pip_repository.bzl b/python/pip_install/pip_repository.bzl index b897e8c56a..aa33d2d1f3 100644 --- a/python/pip_install/pip_repository.bzl +++ b/python/pip_install/pip_repository.bzl @@ -22,7 +22,6 @@ load("//python/pip_install:requirements_parser.bzl", parse_requirements = "parse load("//python/pip_install/private:generate_group_library_build_bazel.bzl", "generate_group_library_build_bazel") load("//python/pip_install/private:generate_whl_library_build_bazel.bzl", "generate_whl_library_build_bazel") load("//python/pip_install/private:srcs.bzl", "PIP_INSTALL_PY_SRCS") -load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") load("//python/private:normalize_name.bzl", "normalize_name") load("//python/private:patch_whl.bzl", "patch_whl") load("//python/private:render_pkg_aliases.bzl", "render_pkg_aliases") @@ -85,13 +84,12 @@ def _resolve_python_interpreter(rctx): if rctx.attr.python_interpreter_target != None: python_interpreter = rctx.path(rctx.attr.python_interpreter_target) - if BZLMOD_ENABLED: - (os, _) = get_host_os_arch(rctx) + (os, _) = get_host_os_arch(rctx) - # On Windows, the symlink doesn't work because Windows attempts to find - # Python DLLs where the symlink is, not where the symlink points. - if os == WINDOWS_NAME: - python_interpreter = python_interpreter.realpath + # On Windows, the symlink doesn't work because Windows attempts to find + # Python DLLs where the symlink is, not where the symlink points. + if os == WINDOWS_NAME: + python_interpreter = python_interpreter.realpath elif "/" not in python_interpreter: # It's a plain command, e.g. "python3", to look up in the environment. found_python_interpreter = rctx.which(python_interpreter)