Skip to content

Commit fdcfc7b

Browse files
committed
enhance Python config checks and add python to user-config.jam
1 parent 5044873 commit fdcfc7b

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

easybuild/easyblocks/b/boost.py

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,18 @@ def configure_step(self):
145145
bootstrap_opts[without_libs].append('mpi')
146146
self.log.debug("Boost.MPI disabled through '%s' in 'configopts'", without_libs)
147147

148+
# Check Python configuration settings
149+
if not self.pyvers:
150+
if 'python' not in bootstrap_opts[without_libs] and 'python' not in bootstrap_opts[with_libs]:
151+
bootstrap_opts[without_libs].append('python')
152+
self.log.debug("Boost.Python disabled through '%s' in 'configopts'", without_libs)
153+
148154
# Update configopts
149155
for libs_arg in [with_libs, without_libs]:
150156
if len(bootstrap_opts[libs_arg]) == 0:
151157
del bootstrap_opts[libs_arg]
152158

153-
new_configopts = ['='.join([opt,','.join(val)]) for opt, val in bootstrap_opts.items()]
159+
new_configopts = ['='.join([opt, ','.join(val)]) for opt, val in bootstrap_opts.items()]
154160
new_configopts.extend(bootstrap_bools) # re-add boolean opts
155161
self.cfg['configopts'] = ' '.join(new_configopts)
156162

@@ -172,20 +178,20 @@ def configure_step(self):
172178
tup = (self.cfg['preconfigopts'], toolset, self.objdir, self.cfg['configopts'])
173179
run_cmd(cmd % tup, log_all=True, simple=True)
174180

175-
if self.cfg['boost_mpi']:
181+
# Fine grained configurations are passed through file 'user-config.jam'
182+
user_config = ''
176183

177-
self.toolchain.options['usempi'] = True
178-
# configure the boost mpi module
179-
# http://www.boost.org/doc/libs/1_47_0/doc/html/mpi/getting_started.html
180-
# let Boost.Build know to look here for the config file
184+
# Configure the boost mpi module
185+
# http://www.boost.org/doc/libs/1_47_0/doc/html/mpi/getting_started.html
186+
# let Boost.Build know to look here for the config file
187+
if self.cfg['boost_mpi']:
181188

182-
txt = ''
183189
# Check if using a Cray toolchain and configure MPI accordingly
184190
if self.toolchain.toolchain_family() == toolchain.CRAYPE:
185191
if self.toolchain.PRGENV_MODULE_NAME_SUFFIX == 'gnu':
186192
craympichdir = os.getenv('CRAY_MPICH2_DIR')
187193
craygccversion = os.getenv('GCC_VERSION')
188-
txt = '\n'.join([
194+
user_config_mpi = '\n'.join([
189195
'local CRAY_MPICH2_DIR = %s ;' % craympichdir,
190196
'using gcc ',
191197
': %s' % craygccversion,
@@ -202,10 +208,20 @@ def configure_step(self):
202208
])
203209
else:
204210
raise EasyBuildError("Bailing out: only PrgEnv-gnu supported for now")
211+
# MPI families without specific configuration
205212
else:
206-
txt = "using mpi : %s ;" % os.getenv("MPICXX")
213+
user_config_mpi = "using mpi : %s ;" % os.getenv("MPICXX")
214+
215+
self.log.debug("Updating configuration file 'user-config.jam' with MPI settings")
216+
user_config = '\n'.join([user_config, user_config_mpi])
217+
218+
# Configure the boost python module
219+
if self.pyvers:
220+
self.log.debug("Updating configuration file 'user-config.jam' with Python settings")
221+
user_config_py = "using python : : %s" % os.path.join(get_software_root('Python'), 'bin/python')
222+
user_config = '\n'.join([user_config, user_config_py])
207223

208-
write_file('user-config.jam', txt, append=True)
224+
write_file('user-config.jam', user_config, append=True)
209225

210226
def build_boost_variant(self, bjamoptions, paracmd):
211227
"""Build Boost library with specified options for bjam."""

0 commit comments

Comments
 (0)