diff mbox series

[ovs-dev,v3] python-windows: Update python3 environment variables on Windows

Message ID 20180416194209.1304-1-aserdean@ovn.org
State Accepted
Headers show
Series [ovs-dev,v3] python-windows: Update python3 environment variables on Windows | expand

Commit Message

Alin-Gabriel Serdean April 16, 2018, 7:42 p.m. UTC
Starting from Python 3.6 two new environment variables have been introduced
on Windows:
PYTHONLEGACYWINDOWSFSENCODING
https://docs.python.org/3/using/cmdline.html#envvar-PYTHONLEGACYWINDOWSFSENCODING
PYTHONLEGACYWINDOWSSTDIO
https://docs.python.org/3/using/cmdline.html#envvar-PYTHONLEGACYWINDOWSSTDIO

To keep backwards compatibility when running tests under Windows we define and
set the two variables thus ensuring default filesystem encoding (mbcs).

Fixes tests on Python version >=3.6:
2030: simple idl, writing via IDL with unicode - Python3
2032: simple idl, writing via IDL with unicode - Python3 - register_columns
2034: simple idl, writing via IDL with unicode - Python3 - tcp

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Co-authored-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
Signed-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
---
 tests/atlocal.in | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Ben Pfaff April 16, 2018, 8:04 p.m. UTC | #1
On Mon, Apr 16, 2018 at 10:42:09PM +0300, Alin Gabriel Serdean wrote:
> Starting from Python 3.6 two new environment variables have been introduced
> on Windows:
> PYTHONLEGACYWINDOWSFSENCODING
> https://docs.python.org/3/using/cmdline.html#envvar-PYTHONLEGACYWINDOWSFSENCODING
> PYTHONLEGACYWINDOWSSTDIO
> https://docs.python.org/3/using/cmdline.html#envvar-PYTHONLEGACYWINDOWSSTDIO
> 
> To keep backwards compatibility when running tests under Windows we define and
> set the two variables thus ensuring default filesystem encoding (mbcs).
> 
> Fixes tests on Python version >=3.6:
> 2030: simple idl, writing via IDL with unicode - Python3
> 2032: simple idl, writing via IDL with unicode - Python3 - register_columns
> 2034: simple idl, writing via IDL with unicode - Python3 - tcp
> 
> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> Co-authored-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
> Signed-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>

Acked-by: Ben Pfaff <blp@ovn.org>
Alin-Gabriel Serdean April 16, 2018, 8:15 p.m. UTC | #2
> On 16 Apr 2018, at 23:04, Ben Pfaff <blp@ovn.org> wrote:
> 
> On Mon, Apr 16, 2018 at 10:42:09PM +0300, Alin Gabriel Serdean wrote:
>> Starting from Python 3.6 two new environment variables have been introduced
>> on Windows:
>> PYTHONLEGACYWINDOWSFSENCODING
>> https://docs.python.org/3/using/cmdline.html#envvar-PYTHONLEGACYWINDOWSFSENCODING
>> PYTHONLEGACYWINDOWSSTDIO
>> https://docs.python.org/3/using/cmdline.html#envvar-PYTHONLEGACYWINDOWSSTDIO
>> 
>> To keep backwards compatibility when running tests under Windows we define and
>> set the two variables thus ensuring default filesystem encoding (mbcs).
>> 
>> Fixes tests on Python version >=3.6:
>> 2030: simple idl, writing via IDL with unicode - Python3
>> 2032: simple idl, writing via IDL with unicode - Python3 - register_columns
>> 2034: simple idl, writing via IDL with unicode - Python3 - tcp
>> 
>> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
>> Co-authored-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
>> Signed-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
> 
> Acked-by: Ben Pfaff <blp@ovn.org <mailto:blp@ovn.org>>

Thanks! Applied on master.
diff mbox series

Patch

diff --git a/tests/atlocal.in b/tests/atlocal.in
index bf15a1913..6af420c47 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -106,6 +106,15 @@  FreeBSD|NetBSD)
     ;;
 esac
 
+if test x"$PYTHON3" != x && test "$IS_WIN32" = yes; then
+    # enables legacy windows unicode printing needed for Python3 compatibility
+    # with the Python2 tests
+    PYTHONLEGACYWINDOWSFSENCODING=true
+    export PYTHONLEGACYWINDOWSFSENCODING
+    PYTHONLEGACYWINDOWSSTDIO=true
+    export PYTHONLEGACYWINDOWSSTDIO
+fi
+
 # Check whether to run IPv6 tests.
 if $PYTHON -c '
 import socket