Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions easybuild/easyblocks/a/amber.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
from easybuild.easyblocks.generic.pythonpackage import det_pylibdir
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.modules import get_software_root
from easybuild.tools.modules import get_software_root, get_software_version
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.filetools import remove_dir, which
from easybuild.tools.systemtools import get_shared_lib_ext


class EB_Amber(CMakeMake):
Expand Down Expand Up @@ -164,13 +165,25 @@ def configure_step(self):

pythonroot = get_software_root('Python')
if pythonroot:
version = get_software_version('Python')
shlib_ext = get_shared_lib_ext()
self.cfg.update('configopts', '-DDOWNLOAD_MINICONDA=FALSE')
self.cfg.update('configopts', '-DPYTHON_EXECUTABLE=%s' % os.path.join(pythonroot, 'bin', 'python'))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as this is now set by the CMake configure_step


self.pylibdir = det_pylibdir()
pythonpath = os.environ.get('PYTHONPATH', '')
env.setvar('PYTHONPATH', os.pathsep.join([os.path.join(self.installdir, self.pylibdir), pythonpath]))

# AmberTools uses the deprecated FindPythonLibs. Ensure we use the correct library and include dir
version_maj_min = '.'.join(version.split('.')[:2])
python_library = os.path.join(pythonroot, 'lib', f'libpython{version_maj_min}.{shlib_ext}')
python_incdir = os.path.join(pythonroot, 'include', 'python%s' % version_maj_min)
if not os.path.isfile(python_library):
raise EasyBuildError("Cannot find Python library '%s'!" % python_library)
if not os.path.isdir(python_incdir):
raise EasyBuildError("Cannot find Python include directory '%s'!" % python_incdir)
self.cfg.update('configopts', f'-DPYTHON_LIBRARY={python_library}')
self.cfg.update('configopts', f'-DPYTHON_INCLUDE_DIR={python_incdir}')

if get_software_root('FFTW'):
external_libs_list.append('fftw')
if get_software_root('netCDF'):
Expand Down