From af8611916a9b62fff841ddbdd575f95ba60f559a Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Tue, 30 Jun 2020 20:18:18 +0200 Subject: [PATCH] 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 Reviewed-by: Peter Krempa Reviewed-by: Neal Gompa --- configure.ac | 7 ------- meson.build | 7 +++++++ scripts/meson-python.sh | 3 +++ scripts/meson.build | 1 + 4 files changed, 11 insertions(+), 7 deletions(-) create mode 100755 scripts/meson-python.sh diff --git a/configure.ac b/configure.ac index d5f84f075f..5cdb028239 100644 --- a/configure.ac +++ b/configure.ac @@ -90,13 +90,6 @@ dnl Need to test if pkg-config exists 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 LIBVIRT_WIN_CHECK_SYMBOLS LIBVIRT_WIN_CHECK_WINDRES diff --git a/meson.build b/meson.build index f4b0d25373..c785b12f6c 100644 --- a/meson.build +++ b/meson.build @@ -2202,6 +2202,13 @@ endif 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 top_inc_dir = include_directories('.') diff --git a/scripts/meson-python.sh b/scripts/meson-python.sh new file mode 100755 index 0000000000..9ba670fc1a --- /dev/null +++ b/scripts/meson-python.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8 "$@" diff --git a/scripts/meson.build b/scripts/meson.build index 941e40a091..5d3f0af479 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -18,6 +18,7 @@ scripts = [ 'header-ifdef.py', 'hvsupport.py', 'hyperv_wmi_generator.py', + 'meson-python.sh', 'mock-noinline.py', 'prohibit-duplicate-header.py', 'test-wrap-argv.py',