[Python-modules-commits] r31256 - in packages/pyxb/trunk/debian/patches (1 file)

fladi-guest at users.alioth.debian.org fladi-guest at users.alioth.debian.org
Fri Oct 24 19:09:16 UTC 2014


    Date: Friday, October 24, 2014 @ 19:09:15
  Author: fladi-guest
Revision: 31256

Add 02-setup_open_unicode.patch to make tests work with Python3.

Added:
  packages/pyxb/trunk/debian/patches/02-setup_open_unicode.patch

Added: packages/pyxb/trunk/debian/patches/02-setup_open_unicode.patch
===================================================================
--- packages/pyxb/trunk/debian/patches/02-setup_open_unicode.patch	                        (rev 0)
+++ packages/pyxb/trunk/debian/patches/02-setup_open_unicode.patch	2014-10-24 19:09:15 UTC (rev 31256)
@@ -0,0 +1,29 @@
+Description: open files with UTF-8 encoding on Python3
+ Python3 would open the test files as raw bytes if no encoding is specified,
+ leading to UnicodeDecodeError exceptions.
+Author: Michael Fladischer <FladischerMichael at fladi.at>
+Last-Update: 2014-10-24
+Forwarded: no
+
+--- a/setup.py
++++ b/setup.py
+@@ -18,6 +18,7 @@
+ import re
+ import datetime
+ import logging
++import io
+ 
+ from distutils.core import setup, Command
+ 
+@@ -123,7 +124,10 @@
+                     number += 1
+ 
+                 # Read the test source in and compile it
+-                rv = compile(open(fn).read(), test_name, 'exec')
++                if sys.version_info > (3,):
++                    rv = compile(io.open(fn, encoding='utf-8').read(), test_name, 'exec')
++                else:
++                    rv = compile(open(fn).read(), test_name, 'exec')
+                 state = 'evaluate'
+ 
+                 # Make a copy of the globals array so we don't




More information about the Python-modules-commits mailing list