From 16146fcaa5d982cf2ba7c3aa1d4a43ef2ebd7000 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 3 Sep 2020 22:05:18 +0200 Subject: [PATCH] only add -DPYTHON_EXECUTABLE configure option for pybind11 if it's not specified yet --- easybuild/easyblocks/p/pybind11.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/easybuild/easyblocks/p/pybind11.py b/easybuild/easyblocks/p/pybind11.py index 8c519f3ec1..52073fb155 100644 --- a/easybuild/easyblocks/p/pybind11.py +++ b/easybuild/easyblocks/p/pybind11.py @@ -57,9 +57,15 @@ def extra_options(extra_vars=None): def configure_step(self): """Avoid that a system Python is picked up when a Python module is loaded""" + + # make sure right 'python' command is used for installing pybind11 python_root = get_software_root('Python') - if python_root: - self.cfg.update('configopts', "-DPYTHON_EXECUTABLE=%s/bin/python" % python_root) + python_exe_opt = '-DPYTHON_EXECUTABLE=' + if python_root and python_exe_opt not in self.cfg['configopts']: + configopt = python_exe_opt + os.path.join(python_root, 'bin', 'python') + self.log.info("Adding %s to configopts since it is not specified yet", configopt) + self.cfg.update('configopts', configopt) + super(EB_pybind11, self).configure_step() def test_step(self):