Update the big endian patch. OBS-URL: https://build.opensuse.org/request/show/634930 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-polib?expand=0&rev=32
30 lines
898 B
Diff
30 lines
898 B
Diff
--- a/polib.py
|
|
+++ b/polib.py
|
|
@@ -592,7 +592,7 @@ class _BaseFile(list):
|
|
offsets = koffsets + voffsets
|
|
|
|
output = struct.pack(
|
|
- "Iiiiiii",
|
|
+ "<Iiiiiii",
|
|
# Magic number
|
|
MOFile.MAGIC,
|
|
# Version
|
|
@@ -607,10 +607,15 @@ class _BaseFile(list):
|
|
0, keystart
|
|
|
|
)
|
|
+ outarr = array.array("i", offsets)
|
|
+ # since 0.19.8 msgfmt produces little-endian files by default
|
|
+ if sys.byteorder == "big":
|
|
+ outarr.byteswap()
|
|
+
|
|
if PY3 and sys.version_info.minor > 1: # python 3.2 or superior
|
|
- output += array.array("i", offsets).tobytes()
|
|
+ output += outarr.tobytes()
|
|
else:
|
|
- output += array.array("i", offsets).tostring()
|
|
+ output += outarr.tostring()
|
|
output += ids
|
|
output += strs
|
|
return output
|