Skip to content

Commit

Permalink
[SCons] Synchronize minimum Python versions
Browse files Browse the repository at this point in the history
The minimum Python version is the same for the full and the minimal
interfaces.
  • Loading branch information
bryanwweber committed Jul 10, 2020
1 parent 4143855 commit db04d7b
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,15 @@ if env['python_package'] != 'none':
ruamel_yaml_version, ruamel_min_version))
sys.exit(1)

if len(info) > expected_output_lines:
msg = "WARNING: Unexpected output while checking Python / NumPy / Cython versions:"
if check_for_ruamel_yaml:
msg = msg.split()
msg.insert(-1, "/ ruamel.yaml")
msg = " ".join(msg)
print(msg)
print('| ' + '\n| '.join(info[expected_output_lines:]))

if warn_no_python:
if env['python_package'] == 'default':
print('WARNING: Not building the Python package because the Python '
Expand All @@ -1350,25 +1359,18 @@ if env['python_package'] != 'none':
print('ERROR: Could not execute the Python interpreter {!r}'.format(
env['python_cmd']))
sys.exit(1)
elif env['python_package'] == 'minimal':
print('INFO: Building the minimal Python package for Python {}'.format(python_version))
elif python_version < python_min_version:
msg = ("{}: Python version is incompatible. Found {} but {} "
"or newer is required")
if env["python_package"] in ("minimal", "full"):
print(msg.format("ERROR", python_version, python_min_version))
sys.exit(1)
elif env["python_package"] == "default":
print(msg.format("WARNING", python_version, python_min_version))
env["python_package"] = "none"
else:
warn_no_full_package = False
if len(info) > expected_output_lines:
msg = "WARNING: Unexpected output while checking Python / NumPy / Cython versions:"
if check_for_ruamel_yaml:
msg = msg.split()
msg.insert(-1, "/ ruamel.yaml")
msg = " ".join(msg)
print(msg)
print('| ' + '\n| '.join(info[expected_output_lines:]))

if python_version < python_min_version:
print("WARNING: Python version is incompatible with the full Python module: "
"Found {0} but {1} or newer is required".format(
python_version, python_min_version))
warn_no_full_package = True
elif python_version >= LooseVersion("3.8"):
if python_version >= LooseVersion("3.8"):
# Reset the minimum Cython version if the Python version is 3.8 or higher
# Due to internal changes in the CPython API, more recent versions of
# Cython are necessary to build for Python 3.8. There is nothing Cantera
Expand All @@ -1384,7 +1386,7 @@ if env['python_package'] != 'none':
elif numpy_version < numpy_min_test_version:
print("WARNING: The installed version of NumPy is not tested and "
"support is not guaranteed. Found {0} but {1} or newer is preferred".format(
numpy_version, numpy_min_test_version))
numpy_version, numpy_min_test_version))
else:
print('INFO: Using NumPy version {0}.'.format(numpy_version))

Expand All @@ -1400,14 +1402,14 @@ if env['python_package'] != 'none':
print('INFO: Using Cython version {0}.'.format(cython_version))

if warn_no_full_package:
msg = ('{}: Unable to build the full Python package because compatible '
'versions of Python, Numpy, and Cython could not be found.')
if env['python_package'] == 'default':
print('WARNING: Unable to build the full Python package because compatible '
'versions of Python, Numpy, and Cython could not be found.')
print(msg.format("WARNING"))
print('INFO: Building the minimal Python package for Python {}'.format(python_version))
env['python_package'] = 'minimal'
else:
print('ERROR: Unable to build the full Python package because compatible '
'versions of Python, Numpy, and Cython could not be found.')
print(msg.format("ERROR"))
sys.exit(1)
else:
print('INFO: Building the full Python package for Python {0}'.format(python_version))
Expand Down

0 comments on commit db04d7b

Please sign in to comment.