From 9e789796978b3f582761c5eec6a12bf4e77a3a2e Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Fri, 28 Nov 2025 17:29:05 +0100 Subject: [PATCH 1/2] Set an environment variable to indicate an EB session --- easybuild/framework/easyblock.py | 1 + 1 file changed, 1 insertion(+) diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index 4f04cdabe7..ec4c88b1ed 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -301,6 +301,7 @@ def __init__(self, ec, logfile=None): self.orig_modulepath = os.getenv('MODULEPATH') # keep track of initial environment we start in, so we can restore it if needed + os.environ['___EASYBUILD___'] = "EasyBuild" # set an environment variable to know we are in an EB session self.initial_environ = copy.deepcopy(os.environ) self.reset_environ = None self.tweaked_env_vars = {} From b426cd9c5405403f4a5303b312d4735c670fca10 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Mon, 1 Dec 2025 14:57:37 +0100 Subject: [PATCH 2/2] set $___EASYBUILD___ via prepare_main in main.py --- easybuild/framework/easyblock.py | 1 - easybuild/main.py | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index ec4c88b1ed..4f04cdabe7 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -301,7 +301,6 @@ def __init__(self, ec, logfile=None): self.orig_modulepath = os.getenv('MODULEPATH') # keep track of initial environment we start in, so we can restore it if needed - os.environ['___EASYBUILD___'] = "EasyBuild" # set an environment variable to know we are in an EB session self.initial_environ = copy.deepcopy(os.environ) self.reset_environ = None self.tweaked_env_vars = {} diff --git a/easybuild/main.py b/easybuild/main.py index 8d43709a6e..1af389f2d8 100755 --- a/easybuild/main.py +++ b/easybuild/main.py @@ -792,6 +792,9 @@ def prepare_main(args=None, logfile=None, testing=None): :param testing: enable testing mode :return: 3-tuple with initial session state data, EasyBuildOptions instance, and tuple with configuration settings """ + # set $___EASYBUILD___ environment variable to 'EasyBuild' to indicate that we're in an EasyBuild session + os.environ['___EASYBUILD___'] = 'EasyBuild' + register_lock_cleanup_signal_handlers() # if $CDPATH is set, unset it, it'll only cause trouble...