From cc8c19bd4049823e05b2ef004c356c939111bcc2 Mon Sep 17 00:00:00 2001 From: Boris Basic <boris.basic@edf.fr> Date: Wed, 4 Dec 2024 16:02:47 +0100 Subject: [PATCH] Use Python pth file instead of PYTHONPATH This prevents conflicts with other Python installations --- build-telemac.bat | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/build-telemac.bat b/build-telemac.bat index d28f60b..7f14707 100644 --- a/build-telemac.bat +++ b/build-telemac.bat @@ -462,8 +462,15 @@ cd %python% rd /s/q libs del dev.msi -rem Remove the _pth file -del python3*._pth +rem Update the _pth file to include TELEMAC scripts and API folders +for /f "tokens=*" %%g in ('dir python*._pth /b') do (set pth_file=%%g) +for /f "tokens=*" %%g in ('dir python*.zip /b') do (set zip_file=%%g) +echo %zip_file%> %pth_file% +echo .>> %pth_file% +echo Lib\site-packages>> %pth_file% +echo ..\..\scripts\python3>> %pth_file% +echo ..\..\builds\gnu.static\wrap_api\lib>> %pth_file% +echo import site>> %pth_file% rem Copy python.exe to python3.exe to ensure the proper execution of TELEMAC rem scripts having the shebang form #!/usr/bin/env python3 @@ -659,9 +666,6 @@ echo rem Add TELEMAC binaries directory to PATH>> %file_name% echo set PATH=%%HOMETEL%%\builds\%%USETELCFG%%\lib;%%PATH%%>> %file_name% echo rem Add TELEMAC Python scripts folder to PATH>> %file_name% echo set PATH=%%HOMETEL%%\scripts\python3;%%PATH%%>> %file_name% -echo rem Add TELEMAC Python scripts to PYTHONPATH>> %file_name% -echo set PYTHONPATH=%%HOMETEL%%\scripts\python3;%%PYTHONPATH%%>> %file_name% -echo set PYTHONPATH=%%HOMETEL%%\builds\%%USETELCFG%%\wrap_api\lib;%%PYTHONPATH%%>> %file_name% echo:>> %file_name% echo rem Paths to external libraries>> %file_name% echo rem HDF5>> %file_name% -- GitLab