SERVER-117040 use py_host target in the bazel wrapper (#46295)

GitOrigin-RevId: 4525949d6fb300a62a318263bf0ca2ba43689ada
This commit is contained in:
Daniel Moody 2026-01-13 12:46:34 -06:00 committed by MongoDB Bot
parent 1a1f39327b
commit c4015c351c
4 changed files with 10 additions and 10 deletions

2
MODULE.bazel.lock generated
View File

@ -211,7 +211,7 @@
"moduleExtensions": {
"//bazel:bzlmod.bzl%setup_mongo_python_toolchains": {
"general": {
"bzlTransitiveDigest": "g63yKdOanT1rISSUfj8CM7JKV5z2OJ41hqnVNqe8iK8=",
"bzlTransitiveDigest": "fy26F18Xxy4wMeHucToHUJoIIIzEgTo84vEw2RmzBi8=",
"usagesDigest": "bUxjq9n+hj2YwYT/lcSP4lHyQ2GVy5JpFgSmddUqUZg=",
"recordedFileInputs": {},
"recordedDirentsInputs": {},

View File

@ -27,7 +27,7 @@ URLS_MAP = {
"windows_amd64": {
"sha": "3933545e6d41462dd6a47e44133ea40995bc6efeed8c2e4cbdf1a699303e95ea",
"url": "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-pc-windows-msvc-shared-install_only.tar.gz",
"interpreter_path": "dist/python3.exe",
"interpreter_path": "dist/python.exe",
},
"macos_aarch64": {
"sha": "916c35125b5d8323a21526d7a9154ca626453f63d0878e95b9f613a95006c990",

View File

@ -206,19 +206,19 @@ fi
cur_dir=$(basename $REPO_ROOT)
python=""
if [ -d $REPO_ROOT/bazel-$cur_dir ]; then
python="$(readlink "$REPO_ROOT/bazel-$cur_dir")/../../external/_main~setup_mongo_python_toolchains~py_${os}_${ARCH}/dist/bin/python3"
python="$(readlink "$REPO_ROOT/bazel-$cur_dir")/../../external/_main~setup_mongo_python_toolchains~py_host/dist/bin/python3"
else
if [ -d $REPO_ROOT/.compiledb/compiledb-$cur_dir ]; then
python="$(readlink "$REPO_ROOT/.compiledb/compiledb-$cur_dir")/../../external/_main~setup_mongo_python_toolchains~py_${os}_${ARCH}/dist/bin/python3"
python="$(readlink "$REPO_ROOT/.compiledb/compiledb-$cur_dir")/../../external/_main~setup_mongo_python_toolchains~py_host/dist/bin/python3"
fi
fi
# if no python use bazel to install one
if [[ "$python" = "" ]] || [ ! -f $python ]; then
>&2 echo "python prereq missing, using bazel to install python..."
>&2 $bazel_real build --bes_backend= --bes_results_url= --workspace_status_command= @py_${os}_${ARCH}//:all
>&2 $bazel_real build --bes_backend= --bes_results_url= --workspace_status_command= @py_host//:all
if [[ $? != 0 ]]; then
>&2 $bazel_real build --config=local --workspace_status_command= @py_${os}_${ARCH}//:all
>&2 $bazel_real build --config=local --workspace_status_command= @py_host//:all
if [[ $? != 0 ]]; then
if [[ ! -z "$CI" ]] || [[ $MONGO_BAZEL_WRAPPER_FALLBACK == 1 ]]; then
>&2 echo "wrapper script failed to install python! falling back to normal bazel call..."
@ -233,7 +233,7 @@ fi
# update python location if it was missing and we had to install it
if [[ "$python" = "" ]] || [ ! -f $python ]; then
python="$(readlink "$REPO_ROOT/bazel-$cur_dir")/../../external/_main~setup_mongo_python_toolchains~py_${os}_${ARCH}/dist/bin/python3"
python="$(readlink "$REPO_ROOT/bazel-$cur_dir")/../../external/_main~setup_mongo_python_toolchains~py_host/dist/bin/python3"
fi
autocomplete_query=0

View File

@ -104,9 +104,9 @@ if exist "%REPO_ROOT%\bazel-%cur_dir%" (
if not defined python (
(
echo python prereq missing, using bazel to install python...
"%BAZEL_REAL%" build --bes_backend= --bes_results_url= --workspace_status_command= @py_windows_x86_64//:all
"%BAZEL_REAL%" build --bes_backend= --bes_results_url= --workspace_status_command= @py_host//:all
if !ERRORLEVEL! NEQ 0 (
"%BAZEL_REAL%" build --config=local --workspace_status_command= @py_windows_x86_64//:all
"%BAZEL_REAL%" build --config=local --workspace_status_command= @py_host//:all
if !ERRORLEVEL! NEQ 0 (
if "%CI%"=="" if "%MONGO_BAZEL_WRAPPER_FALLBACK%"=="" (
call :cleanup_logfile
@ -226,7 +226,7 @@ dir %REPO_ROOT% | C:\Windows\System32\find.exe "bazel-%cur_dir%" > %REPO_ROOT%\t
for /f "tokens=2 delims=[" %%i in (%REPO_ROOT%\tmp_bazel_symlink_dir.txt) do set bazel_real_dir=%%i
del %REPO_ROOT%\tmp_bazel_symlink_dir.txt
set bazel_real_dir=!bazel_real_dir:~0,-1!
set "python=!bazel_real_dir!\..\..\external\_main~setup_mongo_python_toolchains~py_windows_x86_64\dist\python.exe"
set "python=!bazel_real_dir!\..\..\external\_main~setup_mongo_python_toolchains~py_host\dist\python.exe"
exit /b 0
:cleanup_logfile