[libvirt] [PATCH v2 03/24] build: force a UTF-8 locale for python

Eric Blake eblake at redhat.com
Wed Sep 11 17:27:45 UTC 2019


On 9/11/19 11:23 AM, Daniel P. Berrangé wrote:
> 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.

Being UTF-8 vs. being 8-bit clean are not necessarily synonymous, but
the difference shouldn't matter when we only use UTF-8 encoding in our
script source code and inputs.

> 
> 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.
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>  Makefile.am                | 2 +-
>  configure.ac               | 8 ++++++++
>  docs/Makefile.am           | 3 ++-
>  src/esx/Makefile.inc.am    | 2 +-
>  src/hyperv/Makefile.inc.am | 2 +-
>  src/util/Makefile.inc.am   | 8 ++++----
>  6 files changed, 17 insertions(+), 8 deletions(-)

Reviewed-by: Eric Blake <eblake at redhat.com>


> +++ b/src/esx/Makefile.inc.am
> @@ -63,7 +63,7 @@ $(ESX_DRIVER_GENERATED): $(ESX_GENERATED_STAMP)
>  
>  $(ESX_GENERATED_STAMP): $(srcdir)/esx/esx_vi_generator.input \
>                           $(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) $(srcdir)/esx/esx_vi_generator.py \
>  	  && touch $@

Worth rewrapping long lines any differently, since your addition pushes
this beyond 80 columns?


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190911/c4382c84/attachment-0001.sig>


More information about the libvir-list mailing list