meson: add runutf8 env vars and meson-python.sh script

With meson we have to use both env vars and wrapper script to run python
with correct LANG settings.

run_command() and test() have 'env' attribute so we can use it, but
custom_target() doesn't support that attribute. Environment variables
cannot by configured using 'command' because meson checks if the first
item in the list is executable so we have to use a wrapper.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-06-30 20:18:18 +02:00
parent 16bdf27dc9
commit af8611916a
4 changed files with 11 additions and 7 deletions

View File

@ -90,13 +90,6 @@ dnl Need to test if pkg-config exists
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
dnl Python3 < 3.7 treats the C locale as 7-bit only.
dnl We must force env vars so it treats it as UTF-8
dnl regardless of the user's locale.
RUNUTF8="LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8"
AC_SUBST(RUNUTF8)
dnl MinGW checks dnl MinGW checks
LIBVIRT_WIN_CHECK_SYMBOLS LIBVIRT_WIN_CHECK_SYMBOLS
LIBVIRT_WIN_CHECK_WINDRES LIBVIRT_WIN_CHECK_WINDRES

View File

@ -2202,6 +2202,13 @@ endif
conf.set_quoted('TLS_PRIORITY', get_option('tls_priority')) conf.set_quoted('TLS_PRIORITY', get_option('tls_priority'))
# Various definitions
# Python3 < 3.7 treats the C locale as 7-bit only. We must force env vars so
# it treats it as UTF-8 regardless of the user's locale.
runutf8 = [ 'LC_ALL=', 'LANG=C', 'LC_CTYPE=en_US.UTF-8' ]
# define top include directory # define top include directory
top_inc_dir = include_directories('.') top_inc_dir = include_directories('.')

3
scripts/meson-python.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8 "$@"

View File

@ -18,6 +18,7 @@ scripts = [
'header-ifdef.py', 'header-ifdef.py',
'hvsupport.py', 'hvsupport.py',
'hyperv_wmi_generator.py', 'hyperv_wmi_generator.py',
'meson-python.sh',
'mock-noinline.py', 'mock-noinline.py',
'prohibit-duplicate-header.py', 'prohibit-duplicate-header.py',
'test-wrap-argv.py', 'test-wrap-argv.py',