Files
MINGW-packages/mingw-w64-python-babel/babel-fix.patch
2015-07-06 16:52:48 +03:00

99 lines
3.7 KiB
Diff

diff -Naur babel-1.3-orig/babel/localtime/_win32.py babel-1.3/babel/localtime/_win32.py
--- babel-1.3-orig/babel/localtime/_win32.py 2013-07-29 15:33:20.000000000 +0400
+++ babel-1.3/babel/localtime/_win32.py 2015-07-06 09:12:35.343528600 +0300
@@ -10,8 +10,14 @@
import pytz
-tz_names = get_global('windows_zone_mapping')
-
+# When building the cldr data on windows this module gets imported.
+# Because at that point there is no global.dat yet this call will
+# fail. We want to catch it down in that case then and just assume
+# the mapping was empty.
+try:
+ tz_names = get_global('windows_zone_mapping')
+except RuntimeError:
+ tz_names = {}
def valuestodict(key):
"""Convert a registry key's values to a dictionary."""
diff -Naur babel-1.3-orig/babel/messages/frontend.py babel-1.3/babel/messages/frontend.py
--- babel-1.3-orig/babel/messages/frontend.py 2013-07-29 15:33:20.000000000 +0400
+++ babel-1.3/babel/messages/frontend.py 2015-07-06 09:19:44.621596500 +0300
@@ -128,7 +128,7 @@
for idx, (locale, po_file) in enumerate(po_files):
mo_file = mo_files[idx]
- infile = open(po_file, 'r')
+ infile = open(po_file, 'rb')
try:
catalog = read_po(infile, locale)
finally:
@@ -439,7 +439,7 @@
log.info('creating catalog %r based on %r', self.output_file,
self.input_file)
- infile = open(self.input_file, 'r')
+ infile = open(self.input_file, 'rb')
try:
# Although reading from the catalog template, read_po must be fed
# the locale in order to correctly calculate plurals
@@ -554,7 +554,7 @@
if not domain:
domain = os.path.splitext(os.path.basename(self.input_file))[0]
- infile = open(self.input_file, 'U')
+ infile = open(self.input_file, 'rb')
try:
template = read_po(infile)
finally:
@@ -566,7 +566,7 @@
for locale, filename in po_files:
log.info('updating catalog %r based on %r', filename,
self.input_file)
- infile = open(filename, 'U')
+ infile = open(filename, 'rb')
try:
catalog = read_po(infile, locale=locale, domain=domain)
finally:
@@ -577,7 +577,7 @@
tmpname = os.path.join(os.path.dirname(filename),
tempfile.gettempprefix() +
os.path.basename(filename))
- tmpfile = open(tmpname, 'w')
+ tmpfile = open(tmpname, 'wb')
try:
try:
write_po(tmpfile, catalog,
@@ -760,7 +760,7 @@
for idx, (locale, po_file) in enumerate(po_files):
mo_file = mo_files[idx]
- infile = open(po_file, 'r')
+ infile = open(po_file, 'rb')
try:
catalog = read_po(infile, locale)
finally:
@@ -1121,7 +1121,7 @@
tmpname = os.path.join(os.path.dirname(filename),
tempfile.gettempprefix() +
os.path.basename(filename))
- tmpfile = open(tmpname, 'w')
+ tmpfile = open(tmpname, 'wb')
try:
try:
write_po(tmpfile, catalog,
diff -Naur babel-1.3-orig/babel/numbers.py babel-1.3/babel/numbers.py
--- babel-1.3-orig/babel/numbers.py 2013-07-29 15:33:20.000000000 +0400
+++ babel-1.3/babel/numbers.py 2015-07-06 09:16:30.100050600 +0300
@@ -303,7 +303,7 @@
PREFIX_END = r'[^0-9@#.,]'
-NUMBER_TOKEN = r'[0-9@#.\-,E+]'
+NUMBER_TOKEN = r'[0-9@#.,E+]'
PREFIX_PATTERN = r"(?P<prefix>(?:'[^']*'|%s)*)" % PREFIX_END
NUMBER_PATTERN = r"(?P<number>%s+)" % NUMBER_TOKEN