nicogodet / telemac-mascaret-feedstock

https://anaconda.org/nicogodet/opentelemac
2 stars 2 forks source link

Respect env variables upon activation/deactivation #15

Open pmav99 opened 8 months ago

pmav99 commented 8 months ago

activate.sh should respect the existing values of PYTHONPATH and LD_LIBRARY_PATH https://github.com/nicogodet/telemac-mascaret-feedstock/blob/df2599ab94a33f4fb3e91739de3c4d7b5e3583be/recipe/scripts/activate.sh#L17-L20 while deactivate.sh should restore the "old" values of PATH, PYTHONPATH and LD_LIBRARY_PATH and PYTHONUNBUFFERED https://github.com/nicogodet/telemac-mascaret-feedstock/blob/df2599ab94a33f4fb3e91739de3c4d7b5e3583be/recipe/scripts/deactivate.sh#L4-L6

This might be useful for implementing this: https://stackoverflow.com/a/47159781 Alternatively the "before-activation" values need to be stored in a different env variable and get restored upon deactivation.

pmav99 commented 8 months ago

For the record, unless PYTHONUNBUFFERED is somehow required/expected by telemac, I would avoid setting it in the first place. Let the user choose to set it (e.g. via python -u or something). Silently changing default behaviors can be hard to debug.