meson: find python3 via python3 module
authorTim-Philipp Müller <tim@centricular.com>
Fri, 7 Jul 2017 11:06:44 +0000 (12:06 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Fri, 7 Jul 2017 11:07:09 +0000 (12:07 +0100)
And rename python3 variable in meson build files for clarity.

https://bugzilla.gnome.org/show_bug.cgi?id=783198

gst/parse/meson.build
meson.build

index 3ce681d..9ecf0ab 100644 (file)
@@ -72,12 +72,12 @@ gen_grammar = configure_file(input : 'gen_grammar.py.in',
 parser = custom_target('parselex',
   input : 'parse.l',
   output : ['lex.priv_gst_parse_yy.c', 'parse_lex.h'],
-  command : [py3, gen_lex, '@OUTPUT0@', '@OUTPUT1@', '@INPUT@', 'DUMMY']
+  command : [python3, gen_lex, '@OUTPUT0@', '@OUTPUT1@', '@INPUT@', 'DUMMY']
 )
 
 grammar = custom_target('parsegrammar',
   input : 'grammar.y',
   output : ['grammar.tab.c', 'grammar.tab.h'],
-  command : [py3, gen_grammar, '@OUTPUT0@', '@OUTPUT1@', '@INPUT@'],
+  command : [python3, gen_grammar, '@OUTPUT0@', '@OUTPUT1@', '@INPUT@'],
   depends : [parser],
 )
index 6fa2df0..8f4dc2c 100644 (file)
@@ -385,11 +385,7 @@ if libtype == 'static'
 endif
 
 # Used in gst/parse/meson.build and below
-py3 = find_program('python3', required : false)
-if not py3.found()
-  # Maybe 'python' is Python 3
-  py3 = find_program('python')
-endif
+python3 = import('python3').find_python()
 
 bashcomp_dep = dependency('bash-completion', version : '>= 2.0', required : false)
 
@@ -449,6 +445,6 @@ else
   endif
 endif
 
-run_command(py3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')
+run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')
 
 install_data('gst-element-check-1.0.m4', install_dir : join_paths(get_option('datadir'), 'aclocal'))