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

update check_python_version to reflect that only Python >= 3.6 is supported #4270

Merged
merged 3 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
14 changes: 5 additions & 9 deletions easybuild/tools/systemtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,17 +1240,13 @@ def check_python_version():
python_ver = '%d.%d' % (python_maj_ver, python_min_ver)
_log.info("Found Python version %s", python_ver)

if python_maj_ver == 2:
if python_min_ver < 7:
raise EasyBuildError("Python 2.7 is required when using Python 2, found Python %s", python_ver)
else:
_log.info("Running EasyBuild with Python 2 (version %s)", python_ver)

elif python_maj_ver == 3:
if python_min_ver < 5:
raise EasyBuildError("Python 3.5 or higher is required when using Python 3, found Python %s", python_ver)
if python_maj_ver == 3:
if python_min_ver < 6:
raise EasyBuildError("Python 3.6 or higher is required, found Python %s", python_ver)
else:
_log.info("Running EasyBuild with Python 3 (version %s)", python_ver)
elif python_maj_ver < 3:
raise EasyBuildError("EasyBuild is not compatible with Python %s", python_ver)
else:
raise EasyBuildError("EasyBuild is not compatible (yet) with Python %s", python_ver)

Expand Down
12 changes: 8 additions & 4 deletions test/framework/systemtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,19 +867,23 @@ def mock_python_ver(py_maj_ver, py_min_ver):

# mock running with different Python versions
mock_python_ver(1, 4)
error_pattern = r"EasyBuild is not compatible \(yet\) with Python 1.4"
error_pattern = r"EasyBuild is not compatible with Python 1.4"
self.assertErrorRegex(EasyBuildError, error_pattern, check_python_version)

mock_python_ver(4, 0)
error_pattern = r"EasyBuild is not compatible \(yet\) with Python 4.0"
self.assertErrorRegex(EasyBuildError, error_pattern, check_python_version)

mock_python_ver(2, 6)
error_pattern = r"Python 2.7 is required when using Python 2, found Python 2.6"
mock_python_ver(2, 7)
error_pattern = r"EasyBuild is not compatible with Python 2.7"
self.assertErrorRegex(EasyBuildError, error_pattern, check_python_version)

mock_python_ver(3, 5)
error_pattern = r"Python 3.6 or higher is required, found Python 3.5"
self.assertErrorRegex(EasyBuildError, error_pattern, check_python_version)

# no problems when running with a supported Python version
for pyver in [(2, 7), (3, 5), (3, 6), (3, 7)]:
for pyver in [(3, 6), (3, 7)]:
boegel marked this conversation as resolved.
Show resolved Hide resolved
mock_python_ver(*pyver)
self.assertEqual(check_python_version(), pyver)

Expand Down
3 changes: 1 addition & 2 deletions test/framework/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -2988,8 +2988,7 @@ def prep():
# warning is printed and $TMPDIR is set to shorter path if existing $TMPDIR is too long
os.environ['TMPDIR'] = long_tmpdir
tc, stdout, stderr = prep()
# basename of tmpdir will be 6 chars in Python 2, 8 chars in Python 3
regex = re.compile(r"^WARNING: Long \$TMPDIR .* problems with OpenMPI 2.x, using shorter path: /tmp/.{6,8}$")
regex = re.compile(r"^WARNING: Long \$TMPDIR .* problems with OpenMPI 2.x, using shorter path: /tmp/.{8}$")
self.assertTrue(regex.match(stderr), "Pattern '%s' found in: %s" % (regex.pattern, stderr))

# new $TMPDIR should be /tmp/xxxxxx
Expand Down