[GRASS-git] [OSGeo/grass] 9a122a: grass.app: Use sys.executable as a GRASS_PYTHON de...
Vaclav Petras
noreply at github.com
Tue Apr 1 14:36:18 PDT 2025
Branch: refs/heads/main
Home: https://github.com/OSGeo/grass
Commit: 9a122af7b3f9670d41c8962acc464a2e5533a234
https://github.com/OSGeo/grass/commit/9a122af7b3f9670d41c8962acc464a2e5533a234
Author: Vaclav Petras <wenzeslaus at gmail.com>
Date: 2025-04-01 (Tue, 01 Apr 2025)
Changed paths:
M python/grass/app/runtime.py
Log Message:
-----------
grass.app: Use sys.executable as a GRASS_PYTHON default (#5441)
Instead of hardcoding python3 and python3.exe (based on the platform), use sys.executable for the GRASS_PYTHON variable when not set externally. This switches from command-name-only to full path because sys.executable is 'absolute path of the executable binary', so when displayed, it will be little less nice, but likely more correct, e.g., /usr/bin/python (no version) instead of python3, following system configuration. Absolute path is prefered for subprocess execution by tools like bandit and sys.executable, even if we would not be using it here, would be an relevant example of absolute path usage. This will also make the code Python 4 ready and removes the need to handle Windows separately. sys.executable may be empty or None, but we already have a mechanism to set GRASS_PYTHON in special cases which is simply using GRASS_PYTHON externally, so I'm not adding any fallback for sys.executable being empty.
To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications
More information about the grass-commit
mailing list