From 71d741689f1c985ea7ed14765f1a67c2cdfd08ab Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Wed, 26 Feb 2020 18:42:28 +0000 Subject: [PATCH] build: Automatically use python3.5 if available Steam Runtime 1 'scout' has python3.5 as a non-default Python 3 version, and python3.2 as default. Signed-off-by: Simon McVittie <smcv@collabora.com> --- ci/Jenkinsfile | 1 - debian/gitlab-ci.yml | 1 - debian/rules | 6 ------ meson.build | 10 +++++++++- meson_options.txt | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 2d97a06b3..a4e13aedf 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -131,7 +131,6 @@ pipeline { cd src meson \ --prefix="$(pwd)/_build/prefix" \ - -Dpython=python3.5 \ -Dsrcdir=src \ _build ninja -C _build diff --git a/debian/gitlab-ci.yml b/debian/gitlab-ci.yml index b32c8e80f..4b44aa5c3 100644 --- a/debian/gitlab-ci.yml +++ b/debian/gitlab-ci.yml @@ -120,7 +120,6 @@ build:scout: meson \ --prefix="$(pwd)/_build/prefix" \ - -Dpython=python3.5 \ -Dsrcdir=src \ --werror \ _build diff --git a/debian/rules b/debian/rules index 165fe78a9..e5c89d9ff 100755 --- a/debian/rules +++ b/debian/rules @@ -25,15 +25,9 @@ override_dh_auto_clean: rm -fr debian/locales override_dh_auto_configure: - if python3 -c 'if __import__("sys").version_info < (3, 5): raise SystemExit(1)'; then \ - python=python3; \ - else \ - python=python3.5; \ - fi; \ if ! meson _build \ --prefix=/usr/lib/pressure-vessel/relocatable \ -Dman=true \ - -Dpython=/usr/bin/$$python \ -Dsrcdir=src \ -Dversion=$(DEB_VERSION) \ $(meson_options) \ diff --git a/meson.build b/meson.build index 4e652b1a4..c01943700 100644 --- a/meson.build +++ b/meson.build @@ -29,9 +29,17 @@ project( ) prove = find_program('prove', required : false) -python = find_program(get_option('python'), required : true) sh = find_program('sh', required : true) +# We'd like to use import('python').find_installation(), but before +# Meson 0.50 there was a bug where it didn't have a path() method, +# making it useless to us here. +if get_option('python') == '' + python = find_program('python3.5', 'python3', required : true) +else + python = find_program(get_option('python'), required : true) +endif + version = get_option('version') if version == 'auto' git_version_gen = run_command( diff --git a/meson_options.txt b/meson_options.txt index 0931f78eb..8004724c5 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,4 @@ option('man', type : 'boolean', value : false, description : 'enable man pages') -option('python', type : 'string', value : 'python3') +option('python', type : 'string', value : '') option('srcdir', type : 'string', value : '') option('version', type : 'string', value : 'auto') -- GitLab