mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
build: force a UTF-8 locale for python
Python3 versions less than 3.7 have very unhelpful handling of the C locale where they assume data is 7-bit only. This violates POSIX which requires the C locale to be 8-bit clean. Python3 >= 3.7 now assumes that the C locale is always UTF-8. Set env variables to force LC_CTYPE to en_US.UTF-8 so that we get UTF-8 handling on all python versions. Note we do not use C.UTF-8 since not all C libraries support that. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
851dba3f47
commit
ada268012a
@ -69,7 +69,7 @@ NEWS: \
|
|||||||
$(srcdir)/docs/news.xml \
|
$(srcdir)/docs/news.xml \
|
||||||
>$@-tmp \
|
>$@-tmp \
|
||||||
|| { rm -f $@-tmp; exit 1; }; \
|
|| { rm -f $@-tmp; exit 1; }; \
|
||||||
$(PYTHON) $(srcdir)/docs/reformat-news.py $@-tmp >$@ \
|
$(RUNUTF8) $(PYTHON) $(srcdir)/docs/reformat-news.py $@-tmp >$@ \
|
||||||
|| { rm -f $@-tmp; exit 1; }; \
|
|| { rm -f $@-tmp; exit 1; }; \
|
||||||
rm -f $@-tmp; \
|
rm -f $@-tmp; \
|
||||||
fi
|
fi
|
||||||
|
@ -708,6 +708,14 @@ AC_PATH_PROG([FLAKE8], [flake8])
|
|||||||
if test -z "$FLAKE8"; then
|
if test -z "$FLAKE8"; then
|
||||||
AC_MSG_WARN(['flake8' binary is required to check python code style])
|
AC_MSG_WARN(['flake8' binary is required to check python code style])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
AC_PATH_PROG([PERL], [perl])
|
AC_PATH_PROG([PERL], [perl])
|
||||||
if test -z "$PERL"; then
|
if test -z "$PERL"; then
|
||||||
AC_MSG_ERROR(['perl' binary is required to build libvirt])
|
AC_MSG_ERROR(['perl' binary is required to build libvirt])
|
||||||
|
@ -319,7 +319,8 @@ $(APIBUILD_STAMP): $(srcdir)/apibuild.py \
|
|||||||
$(top_srcdir)/src/util/virerror.c \
|
$(top_srcdir)/src/util/virerror.c \
|
||||||
$(top_srcdir)/src/util/virevent.c \
|
$(top_srcdir)/src/util/virevent.c \
|
||||||
$(top_srcdir)/src/util/virtypedparam.c
|
$(top_srcdir)/src/util/virtypedparam.c
|
||||||
$(AM_V_GEN)srcdir=$(srcdir) builddir=$(builddir) $(PYTHON) $(APIBUILD)
|
$(AM_V_GEN)srcdir=$(srcdir) builddir=$(builddir) \
|
||||||
|
$(RUNUTF8) $(PYTHON) $(APIBUILD)
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ $(ESX_DRIVER_GENERATED): $(ESX_GENERATED_STAMP)
|
|||||||
|
|
||||||
$(ESX_GENERATED_STAMP): $(srcdir)/esx/esx_vi_generator.input \
|
$(ESX_GENERATED_STAMP): $(srcdir)/esx/esx_vi_generator.input \
|
||||||
$(srcdir)/esx/esx_vi_generator.py
|
$(srcdir)/esx/esx_vi_generator.py
|
||||||
$(AM_V_GEN)srcdir=$(srcdir) $(PYTHON) $(srcdir)/esx/esx_vi_generator.py \
|
$(AM_V_GEN)srcdir=$(srcdir) $(RUNUTF8) $(PYTHON) \
|
||||||
&& touch $@
|
$(srcdir)/esx/esx_vi_generator.py && touch $@
|
||||||
|
|
||||||
MAINTAINERCLEANFILES += $(ESX_DRIVER_GENERATED) $(ESX_GENERATED_STAMP)
|
MAINTAINERCLEANFILES += $(ESX_DRIVER_GENERATED) $(ESX_GENERATED_STAMP)
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ $(HYPERV_DRIVER_GENERATED): $(HYPERV_GENERATED_STAMP)
|
|||||||
|
|
||||||
$(HYPERV_GENERATED_STAMP): $(srcdir)/hyperv/hyperv_wmi_generator.input \
|
$(HYPERV_GENERATED_STAMP): $(srcdir)/hyperv/hyperv_wmi_generator.input \
|
||||||
$(srcdir)/hyperv/hyperv_wmi_generator.py
|
$(srcdir)/hyperv/hyperv_wmi_generator.py
|
||||||
$(AM_V_GEN)srcdir=$(srcdir) $(PYTHON) \
|
$(AM_V_GEN)srcdir=$(srcdir) $(RUNUTF8) $(PYTHON) \
|
||||||
$(srcdir)/hyperv/hyperv_wmi_generator.py \
|
$(srcdir)/hyperv/hyperv_wmi_generator.py \
|
||||||
&& touch $@
|
&& touch $@
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ util/virkeycodetable_%.h: $(srcdir)/keycodemapdb/data/keymaps.csv \
|
|||||||
$(AM_V_GEN)export NAME=`echo $@ | sed -e 's,util/virkeycodetable_,,' \
|
$(AM_V_GEN)export NAME=`echo $@ | sed -e 's,util/virkeycodetable_,,' \
|
||||||
-e 's,\.h,,'` && \
|
-e 's,\.h,,'` && \
|
||||||
$(MKDIR_P) util/ && \
|
$(MKDIR_P) util/ && \
|
||||||
$(PYTHON) $(srcdir)/keycodemapdb/tools/keymap-gen \
|
$(RUNUTF8) $(PYTHON) $(srcdir)/keycodemapdb/tools/keymap-gen \
|
||||||
--lang stdc --varname virKeyCodeTable_$$NAME code-table \
|
--lang stdc --varname virKeyCodeTable_$$NAME code-table \
|
||||||
$(srcdir)/keycodemapdb/data/keymaps.csv $$NAME > $@-tmp && \
|
$(srcdir)/keycodemapdb/data/keymaps.csv $$NAME > $@-tmp && \
|
||||||
mv $@-tmp $@ || rm -f $@-tmp
|
mv $@-tmp $@ || rm -f $@-tmp
|
||||||
@ -310,7 +310,7 @@ util/virkeynametable_%.h: $(srcdir)/keycodemapdb/data/keymaps.csv \
|
|||||||
$(AM_V_GEN)export NAME=`echo $@ | sed -e 's,util/virkeynametable_,,' \
|
$(AM_V_GEN)export NAME=`echo $@ | sed -e 's,util/virkeynametable_,,' \
|
||||||
-e 's,\.h,,'` && \
|
-e 's,\.h,,'` && \
|
||||||
$(MKDIR_P) util/ && \
|
$(MKDIR_P) util/ && \
|
||||||
$(PYTHON) $(srcdir)/keycodemapdb/tools/keymap-gen \
|
$(RUNUTF8) $(PYTHON) $(srcdir)/keycodemapdb/tools/keymap-gen \
|
||||||
--lang stdc --varname virKeyNameTable_$$NAME name-table \
|
--lang stdc --varname virKeyNameTable_$$NAME name-table \
|
||||||
$(srcdir)/keycodemapdb/data/keymaps.csv $$NAME > $@-tmp && \
|
$(srcdir)/keycodemapdb/data/keymaps.csv $$NAME > $@-tmp && \
|
||||||
mv $@-tmp $@ || rm -f $@-tmp
|
mv $@-tmp $@ || rm -f $@-tmp
|
||||||
@ -320,7 +320,7 @@ util/virkeycode-%.pod: $(srcdir)/keycodemapdb/data/keymaps.csv \
|
|||||||
$(AM_V_GEN)export NAME=`echo $@ | sed -e 's,util/virkeycode-,,' \
|
$(AM_V_GEN)export NAME=`echo $@ | sed -e 's,util/virkeycode-,,' \
|
||||||
-e 's,\.pod,,'` && \
|
-e 's,\.pod,,'` && \
|
||||||
$(MKDIR_P) util/ && \
|
$(MKDIR_P) util/ && \
|
||||||
$(PYTHON) $(srcdir)/keycodemapdb/tools/keymap-gen \
|
$(RUNUTF8) $(PYTHON) $(srcdir)/keycodemapdb/tools/keymap-gen \
|
||||||
--lang pod \
|
--lang pod \
|
||||||
--varname "virkeycode-$$NAME - Key code values for $$NAME" \
|
--varname "virkeycode-$$NAME - Key code values for $$NAME" \
|
||||||
code-docs \
|
code-docs \
|
||||||
@ -332,7 +332,7 @@ util/virkeyname-%.pod: $(srcdir)/keycodemapdb/data/keymaps.csv \
|
|||||||
$(AM_V_GEN)export NAME=`echo $@ | sed -e 's,util/virkeyname-,,' \
|
$(AM_V_GEN)export NAME=`echo $@ | sed -e 's,util/virkeyname-,,' \
|
||||||
-e 's,\.pod,,'` && \
|
-e 's,\.pod,,'` && \
|
||||||
$(MKDIR_P) util/ && \
|
$(MKDIR_P) util/ && \
|
||||||
$(PYTHON) $(srcdir)/keycodemapdb/tools/keymap-gen \
|
$(RUNUTF8) $(PYTHON) $(srcdir)/keycodemapdb/tools/keymap-gen \
|
||||||
--lang pod \
|
--lang pod \
|
||||||
--varname "virkeyname-$$NAME - Key name values for $$NAME" \
|
--varname "virkeyname-$$NAME - Key name values for $$NAME" \
|
||||||
name-docs \
|
name-docs \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user