Skip to content

Commit 3a2f803

Browse files
committed
initialise pushenv_env_vars in constructor of buildenv easyblock, rename 'build_envvars' to 'build_env_vars'
1 parent 5e2dca9 commit 3a2f803

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

easybuild/easyblocks/generic/buildenv.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,21 @@ class BuildEnv(Bundle):
5050
def extra_options():
5151
"""Add extra easyconfig parameters for Boost."""
5252
extra_vars = {
53-
'build_envvars': [True, "Export environment variables related to compilers, compilation flags, "
54-
"optimisations, math libaries, etc. (overwriting any existing values).", CUSTOM],
53+
'build_env_vars': [True, "Export environment variables related to compilers, compilation flags, "
54+
"optimisations, math libaries, etc. (overwriting any existing values).", CUSTOM],
5555
'python_executable': ['python3', "Python executable to use for the wrappers (use None to use path to "
5656
"Python executable used by EasyBuild).", CUSTOM],
5757
}
5858
return Bundle.extra_options(extra_vars)
5959

60+
def __init__(self, *args, **kwargs):
61+
"""
62+
Constructor for buildenv easyblock: initialise class variables
63+
"""
64+
super().__init__(*args, **kwargs)
65+
66+
self.pushenv_env_vars = []
67+
6068
def prepare_step(self, *args, **kwargs):
6169
"""
6270
Custom prepare step for buildenv: export rpath wrappers if they are being used
@@ -97,7 +105,7 @@ def make_module_extra(self):
97105
txt = super().make_module_extra()
98106

99107
# include environment variables defined for (non-system) toolchain
100-
for key, val in self.pushenv_envvars:
108+
for key, val in self.pushenv_env_vars:
101109
txt += self.module_generator.set_environment(key, val)
102110

103111
self.log.debug(f"make_module_extra added this: {txt}")
@@ -117,7 +125,7 @@ def make_module_step(self, fake=False):
117125
]
118126

119127
# include environment variables defined for (non-system) toolchain
120-
self.pushenv_envvars = [] # start with an empty list for pushenv vars
128+
self.pushenv_env_vars = [] # start with an empty list for pushenv vars
121129
if self.toolchain.is_system_toolchain():
122130
self.log.warning("buildenv easyblock is not intended for use with a system toolchain!")
123131
else:
@@ -136,7 +144,7 @@ def make_module_step(self, fake=False):
136144
setattr(self.module_load_environment, key, val.split(os.pathsep))
137145
else:
138146
# Push environment variables for everything else
139-
if self.cfg.get('build_envvars'):
140-
self.pushenv_envvars.append((key, {'value': val, 'pushenv': True}))
147+
if self.cfg.get('build_env_vars'):
148+
self.pushenv_env_vars.append((key, {'value': val, 'pushenv': True}))
141149

142150
return super().make_module_step(fake=fake)

0 commit comments

Comments
 (0)