From dae596abd27ada99889a0eaabecc5ffaafd2b01a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Dom=C3=ADnguez=20L=C3=B3pez?= <116071334+Mario-DL@users.noreply.github.com> Date: Fri, 17 May 2024 07:36:23 +0200 Subject: [PATCH] Do not require PYTHON_VERSION to be defined in .bat files (#4770) Signed-off-by: Mario Dominguez (cherry picked from commit 39e8957c4d4c092b9dc37d71cb3c9195b0fc6bce) --- tools/fastdds/fastdds.bat | 15 ++++++++------- tools/fastdds/ros-discovery.bat | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/tools/fastdds/fastdds.bat b/tools/fastdds/fastdds.bat index d796ffcae29..de259c851d9 100644 --- a/tools/fastdds/fastdds.bat +++ b/tools/fastdds/fastdds.bat @@ -22,12 +22,13 @@ if not %ERRORLEVEL%==0 ( ) :: Python version in the form "Major.Minor" -if %PYTHON_VERSION%=="" ( - echo error retrieving python version. Please, make sure python is installed and accessible. - exit /B 65 - ) +if not "%PYTHON_VERSION%" == "" ( + :: Use launcher to profit from shebang hints on fastdds.py + :: Select the correct python version to source the appropriate paths + py -%PYTHON_VERSION% "%dir%\..\tools\fastdds\fastdds.py" %args% +) else ( + :: Use launcher to profit from shebang hints on fastdds.py + :: Select latest available python version + py "%dir%\..\tools\fastdds\fastdds.py" %args% ) -:: Use launcher to profit from shebang hints on fastdds.py -:: Select the correct python version to source the appropriate paths -py -%PYTHON_VERSION% "%dir%\..\tools\fastdds\fastdds.py" %args% diff --git a/tools/fastdds/ros-discovery.bat b/tools/fastdds/ros-discovery.bat index 26fee3900cf..66380408acc 100644 --- a/tools/fastdds/ros-discovery.bat +++ b/tools/fastdds/ros-discovery.bat @@ -22,12 +22,13 @@ if not %ERRORLEVEL%==0 ( ) :: Python version in the form "Major.Minor" -if %PYTHON_VERSION%=="" ( - echo error retrieving python version. Please, make sure python is installed and accessible. - exit /B 65 - ) +if not "%PYTHON_VERSION%" == "" ( + :: Use launcher to profit from shebang hints on fastdds.py + :: Select the correct python version to source the appropriate paths + py -%PYTHON_VERSION% "%dir%\..\tools\fastdds\fastdds.py" discovery %args% +) else ( + :: Use launcher to profit from shebang hints on fastdds.py + :: Select latest available python version + py "%dir%\..\tools\fastdds\fastdds.py" discovery %args% ) -:: Use launcher to profit from shebang hints on fastdds.py -:: Select the correct python version to source the appropriate paths -py -%PYTHON_VERSION% "%dir%\..\tools\fastdds\fastdds.py" discovery %args%