Skip to content

Commit eaafb26

Browse files
committed
Let CMakeMake set the Python paths for CMake
When Python is used the CMakeMake easyblock already adds the required CMake options. As it has better logic to do so remove it from derived easyblocks.
1 parent 0ea34a7 commit eaafb26

7 files changed

Lines changed: 2 additions & 31 deletions

File tree

easybuild/easyblocks/a/amber.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ def configure_step(self):
163163
pythonroot = get_software_root('Python')
164164
if pythonroot:
165165
self.cfg.update('configopts', '-DDOWNLOAD_MINICONDA=FALSE')
166-
self.cfg.update('configopts', '-DPYTHON_EXECUTABLE=%s' % os.path.join(pythonroot, 'bin', 'python'))
167166

168167
self.pylibdir = det_pylibdir()
169168
pythonpath = os.environ.get('PYTHONPATH', '')

easybuild/easyblocks/g/gromacs.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,6 @@ def configure_step(self):
333333
python_root = get_software_root('Python')
334334
if python_root:
335335
self.cfg.update('configopts', "-DGMX_PYTHON_PACKAGE=ON")
336-
bin_python = os.path.join(python_root, 'bin', 'python')
337-
# For find_package(PythonInterp)
338-
self.cfg.update('configopts', "-DPYTHON_EXECUTABLE=%s" % bin_python)
339-
if gromacs_version >= '2021':
340-
# For find_package(Python3) - Ignore virtual envs
341-
self.cfg.update('configopts', "-DPython3_FIND_VIRTUALENV=STANDARD")
342336

343337
# Now patch GROMACS for PLUMED before cmake
344338
if plumed_root:

easybuild/easyblocks/l/lammps.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,6 @@ def configure_step(self, **kwargs):
448448
raise EasyBuildError("Failed to determine Python include dir: %s", res.output)
449449
python_include_dir = res.output.strip()
450450

451-
# Whether you need one or the other of the options below depends on the version of CMake and LAMMPS
452-
# Rather than figure this out, use both (and one will be ignored)
453-
self.cfg.update('configopts', '-DPython_EXECUTABLE=%s/bin/python' % python_dir)
454-
self.cfg.update('configopts', '-DPYTHON_EXECUTABLE=%s/bin/python' % python_dir)
455-
456451
# Older LAMMPS need more hints to get things right as they use deprecated CMake packages
457452
self.cfg.update('configopts', '-DPYTHON_LIBRARY=%s' % python_lib_path)
458453
self.cfg.update('configopts', '-DPYTHON_INCLUDE_DIR=%s' % python_include_dir)

easybuild/easyblocks/n/neuron.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ def configure_step(self):
8888
if self.python_root:
8989
python_cfgopts = " ".join([
9090
"-DNRN_ENABLE_PYTHON=ON",
91-
f"-DPYTHON_EXECUTABLE={self.python_root}/bin/python",
9291
"-DNRN_ENABLE_MODULE_INSTALL=ON",
9392
f"-DNRN_MODULE_INSTALL_OPTIONS='--prefix={self.installdir}'",
9493
])
@@ -100,7 +99,7 @@ def configure_step(self):
10099
self.pylibdir = det_pylibdir()
101100

102101
# complete configuration with configure_method of parent
103-
CMakeMake.configure_step(self)
102+
super().configure_step()
104103

105104
def test_step(self):
106105
"""Custom tests for NEURON."""

easybuild/easyblocks/p/psi.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ def configure_step(self):
141141
ConfigureMake.configure_step(self, cmd_prefix=self.cfg['start_dir'])
142142
else:
143143
self.log.info("Using CMake based build")
144-
self.cfg.update('configopts', ' -DPYTHON_EXECUTABLE=%s' % os.path.join(pythonroot, 'bin', 'python'))
145144
if self.name == 'PSI4' and LooseVersion(self.version) >= LooseVersion("1.2"):
146145
self.log.info("Remove the CMAKE_BUILD_TYPE test in PSI4 source and the downloaded dependencies!")
147146
self.log.info("Use PATCH_COMMAND in the corresponding CMakeLists.txt")

easybuild/easyblocks/p/pybind11.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
from easybuild.tools.build_log import EasyBuildError
3636
from easybuild.tools.filetools import change_dir
3737
from easybuild.tools.run import run_shell_cmd
38-
from easybuild.tools.modules import get_software_root
3938

4039

4140
class EB_pybind11(CMakePythonPackage):
@@ -46,19 +45,6 @@ class EB_pybind11(CMakePythonPackage):
4645
Hence we need to install PyBind11 twice: Once with CMake and once with pip
4746
"""
4847

49-
def configure_step(self):
50-
"""Avoid that a system Python is picked up when a Python module is loaded"""
51-
52-
# make sure right 'python' command is used for installing pybind11
53-
python_root = get_software_root('Python')
54-
python_exe_opt = '-DPYTHON_EXECUTABLE='
55-
if python_root and python_exe_opt not in self.cfg['configopts']:
56-
configopt = python_exe_opt + os.path.join(python_root, 'bin', 'python')
57-
self.log.info("Adding %s to configopts since it is not specified yet", configopt)
58-
self.cfg.update('configopts', configopt)
59-
60-
super().configure_step()
61-
6248
def test_step(self):
6349
"""Run pybind11 tests"""
6450
# run tests unless explicitly disabled

easybuild/easyblocks/r/root.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def configure_step(self):
110110
python_root = get_software_root('Python')
111111
if python_root:
112112
pyshortver = '.'.join(get_software_version('Python').split('.')[:2])
113-
self.cfg.update('configopts', '-DPYTHON_EXECUTABLE=%s' % os.path.join(python_root, 'bin', 'python'))
114113
python_inc_dir = find_glob_pattern(os.path.join(python_root, 'include', 'python%s*' % pyshortver))
115114
self.cfg.update('configopts', '-DPYTHON_INCLUDE_DIR=%s' % python_inc_dir)
116115
python_lib = find_glob_pattern(
@@ -124,7 +123,7 @@ def configure_step(self):
124123
if sysroot:
125124
self.cfg.update('configopts', '-DDEFAULT_SYSROOT=%s' % sysroot)
126125

127-
CMakeMake.configure_step(self)
126+
super().configure_step()
128127
else:
129128
if self.cfg['arch'] is None:
130129
raise EasyBuildError("No architecture specified to pass to configure script")

0 commit comments

Comments
 (0)