From 83ee14690fdd465cd082a8289c5895e9bfc5c732 Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Sat, 7 Sep 2024 14:03:11 -0400 Subject: [PATCH] grass.app: Move ISIS integration to the library (#4169) Path setup for ISIS was lost in GIS variable setup. This moves it to the library, where other paths and integrations are initialized. The variables are left as is, without further testing. --- lib/init/grass.py | 14 -------------- python/grass/app/runtime.py | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/init/grass.py b/lib/init/grass.py index 87a69f5ef65..82c1ee4a812 100755 --- a/lib/init/grass.py +++ b/lib/init/grass.py @@ -1073,20 +1073,6 @@ def load_env(grass_env_file): # create a new environment variable os.environ[k] = v - # Allow for mixed ISIS-GRASS Environment - if os.getenv("ISISROOT"): - isis = os.getenv("ISISROOT") - os.environ["ISIS_LIB"] = isis + os.sep + "lib" - os.environ["ISIS_3RDPARTY"] = isis + os.sep + "3rdParty" + os.sep + "lib" - os.environ["QT_PLUGIN_PATH"] = isis + os.sep + "3rdParty" + os.sep + "plugins" - # os.environ['ISIS3DATA'] = isis + "$ISIS3DATA" - libpath = os.getenv("LD_LIBRARY_PATH", "") - isislibpath = os.getenv("ISIS_LIB") - isis3rdparty = os.getenv("ISIS_3RDPARTY") - os.environ["LD_LIBRARY_PATH"] = ( - libpath + os.pathsep + isislibpath + os.pathsep + isis3rdparty - ) - def install_notranslation(): # If locale is not supported, _ function might be missing diff --git a/python/grass/app/runtime.py b/python/grass/app/runtime.py index 5da00bae0df..3f3805c9dfd 100644 --- a/python/grass/app/runtime.py +++ b/python/grass/app/runtime.py @@ -129,6 +129,7 @@ def set_paths(install_path, grass_config_dir, ld_library_path_variable_name): # retrieving second time, but now it is always set addon_base = os.getenv("GRASS_ADDON_BASE") set_man_path(install_path=install_path, addon_base=addon_base, env=os.environ) + set_isis() def set_man_path(install_path, addon_base, env): @@ -274,6 +275,25 @@ def set_browser(install_path): os.environ["GRASS_HTML_BROWSER"] = browser +def set_isis(): + """Enable a mixed ISIS-GRASS environment + + ISIS is Integrated Software for Imagers and Spectrometers by USGS. + """ + if os.getenv("ISISROOT"): + isis = os.getenv("ISISROOT") + os.environ["ISIS_LIB"] = isis + os.sep + "lib" + os.environ["ISIS_3RDPARTY"] = isis + os.sep + "3rdParty" + os.sep + "lib" + os.environ["QT_PLUGIN_PATH"] = isis + os.sep + "3rdParty" + os.sep + "plugins" + # os.environ['ISIS3DATA'] = isis + "$ISIS3DATA" + libpath = os.getenv("LD_LIBRARY_PATH", "") + isislibpath = os.getenv("ISIS_LIB") + isis3rdparty = os.getenv("ISIS_3RDPARTY") + os.environ["LD_LIBRARY_PATH"] = ( + libpath + os.pathsep + isislibpath + os.pathsep + isis3rdparty + ) + + def ensure_home(): """Set HOME if not set on MS Windows""" if WINDOWS and not os.getenv("HOME"):