Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use major/minor version of Python command being used if req_py_majver/req_py_minver are not specified #1907

Merged
merged 1 commit into from
Jan 7, 2020
Merged
Changes from all commits
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: 13 additions & 4 deletions easybuild/easyblocks/generic/pythonpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def extra_options(extra_vars=None):
'download_dep_fail': [None, "Fail if downloaded dependencies are detected", CUSTOM],
'install_target': ['install', "Option to pass to setup.py", CUSTOM],
'pip_ignore_installed': [True, "Let pip ignore installed Python packages (i.e. don't remove them)", CUSTOM],
'req_py_majver': [2, "Required major Python version (only relevant when using system Python)", CUSTOM],
'req_py_minver': [6, "Required minor Python version (only relevant when using system Python)", CUSTOM],
'req_py_majver': [None, "Required major Python version (only relevant when using system Python)", CUSTOM],
'req_py_minver': [None, "Required minor Python version (only relevant when using system Python)", CUSTOM],
'sanity_pip_check': [False, "Run 'pip check' to ensure all required Python packages are installed", CUSTOM],
'runtest': [True, "Run unit tests.", CUSTOM], # overrides default
'unpack_sources': [True, "Unpack sources prior to build/install", CUSTOM],
Expand Down Expand Up @@ -347,9 +347,9 @@ def set_pylibdirs(self):

def prepare_python(self):
"""Python-specific preperations."""

# pick 'python' command to use
python = None

python_root = get_software_root('Python')
# keep in mind that Python may be listed as an allowed system dependency,
# so just checking Python root is not sufficient
Expand All @@ -361,8 +361,17 @@ def prepare_python(self):
self.log.debug("Retaining 'python' command for Python dependency: %s", python)

if python is None:
# if no Python version requirements are specified,
# use major/minor version of Python being used in this EasyBuild session
req_py_majver = self.cfg['req_py_majver']
if req_py_majver is None:
req_py_majver = sys.version_info[0]
req_py_minver = self.cfg['req_py_minver']
if req_py_minver is None:
req_py_minver = sys.version_info[1]

# if using system Python, go hunting for a 'python' command that satisfies the requirements
python = pick_python_cmd(req_maj_ver=self.cfg['req_py_majver'], req_min_ver=self.cfg['req_py_minver'])
python = pick_python_cmd(req_maj_ver=req_py_majver, req_min_ver=req_py_minver)

if python:
self.python_cmd = python
Expand Down