Skip to content

Commit

Permalink
No longer hard-code python3.12 path, rather find it, and then make cu…
Browse files Browse the repository at this point in the history
…stom PATH with only System32/Python folders. Deal with spaces in names too
  • Loading branch information
dstanev-atvi committed Dec 18, 2023
1 parent e9156bd commit d0ebdc6
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions otel_sdk_build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ set BAZEL_SH=
set BAZEL_VC=
set BAZEL_VC_FULL_VERSION=

for /F "delims=" %%i in ("%ComSpec%") do set __COMSPEC_DIR__=%%~dpi
if "%__COMSPEC_DIR__%"=="" goto:no-comspec

for /F "usebackq delims=" %%i in (`where python`) do set __PYTHON_DIR__=%%~dpi
if "%__PYTHON_DIR__%"=="" goto:no-python

rem Look first for bazelisk, then bazel
for /F "usebackq" %%i in (`where bazelisk bazel`) do set __BAZEL__=%%i
for /F "usebackq delims=" %%i in (`where bazelisk bazel`) do set __BAZEL__=%%i
if "%__BAZEL__%"=="" goto:no-bazel

set PATH=c:\windows\system32;c:\program files\python312
set PATH=%__COMSPEC_DIR__%;%__PYTHON_DIR__%
pushd "%~dp0"

"%__BAZEL__%" build -k --//:with_dll=true ...
Expand All @@ -36,7 +42,15 @@ endlocal
goto:eof

:no-bazel
echo FAILED: No bazel.exe found!
echo FAILED: No bazelisk or bazel found!
goto:eof

:no-python
echo FAILED: No python found!
goto:eof

:no-comspec
echo FAILED: No ComSpec env var set!
goto:eof

:error
Expand Down

0 comments on commit d0ebdc6

Please sign in to comment.