Fix python version check (python's sysconfig.get_python_version() returns only major.minor)

This commit is contained in:
Félix Piédallu 2020-07-08 11:17:26 +02:00 committed by Jehan
parent 0829dba97f
commit 5c2fd398df
1 changed files with 7 additions and 5 deletions

View File

@ -914,7 +914,7 @@ perl = find_program('perl5', 'perl', 'perl5.005', 'perl5.004', 'perl')
# This can be useful in particular when cross-compiling since anyway
# the interpreter is not useful at build time.
python3_minver = '>=3.6.0'
python3_minver = '>=3.6'
if get_option('python') == 'never'
python_warning = '''
@ -933,10 +933,11 @@ else
always_install = get_option('python') == 'always'
python = pythonmod.find_installation('python3', required: false)
message('Found Python @0@'.format(python.language_version()))
python_found = (
python.found() and
python.language_version().version_compare('>='+python3_minver)
python.language_version().version_compare(python3_minver)
)
if python_found
pygobject_found = run_command(
@ -947,21 +948,22 @@ else
'''sys.exit(gi.check_version(version))''',
]),
).returncode() == 0
message('Found Pygobject: @0@'.format(pygobject_found))
python_found = python_found and pygobject_found
endif
if (not python_found) and (not always_install)
error('''
Python >=@0@ or PyGObject was not found.
Python @0@ or PyGObject was not found.
Note that you may install the Python plug-ins even if you have no Python
interpreter at build-time by passing the configure option -Dpython=always.
Just make sure that a Python >=@0@ interpreter is available at run-time.
Just make sure that a Python @0@ interpreter is available at run-time.
'''.format(python3_minver))
endif
if (not python_found) and (always_install)
python_warning = '''
Python >=@0@ or PyGObject was not found.
Python @0@ or PyGObject was not found.
Python plug-ins will be installed anyway but you should make sure that
a compatible Python interpreter is available at installation, otherwise
installed plug-ins won't be usable.