Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Grund <[email protected]>
  • Loading branch information
Crivella and Flamefire authored Oct 10, 2024
1 parent 7aff4c0 commit cd7cad3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions easybuild/easyblocks/generic/cmakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ def setup_cmake_env(tc):


def setup_cmake_env_python_hints(cmake_version=None):
"""Convenience function to set CMake hints for FindPython[_2/3] as environment variables.
Needed to avoid wrong Python being picked up by CMake when not called directly by EasyBuild but as step in a
build and no option is provided to set custom CMake variables.
"""Set environment variables as hints for CMake to prefer the Python module, if loaded.
Useful when there is no way to specify arguments for CMake directly,
e.g. when CMake is called from within another build system.
Otherwise get_cmake_python_config_[str/dict] should be used instead.
"""
if cmake_version is None:
cmake_version = det_cmake_version()
Expand All @@ -107,7 +108,7 @@ def setup_cmake_env_python_hints(cmake_version=None):


def get_cmake_python_config_dict():
"""Get a dictionary with the CMake configuration options for Python hints."""
"""Get a dictionary with CMake configuration options for finding Python if loaded as a module."""
options = {}
python_root = get_software_root('Python')
if python_root:
Expand All @@ -125,9 +126,11 @@ def get_cmake_python_config_dict():


def get_cmake_python_config_str():
"""Get a string with the CMake configuration options for Python hints."""
"""Get CMake configuration arguments for finding Python if loaded as a module.
This string is intended to be passed to the invocation of `cmake`.
"""
options = get_cmake_python_config_dict()
return ' '.join(['-D%s=%s' % (key, value) for key, value in options.items()])
return ' '.join('-D%s=%s' % (key, value) for key, value in options.items())


class CMakeMake(ConfigureMake):
Expand Down

0 comments on commit cd7cad3

Please sign in to comment.