diff --git a/datrie-bigendian.patch b/datrie-bigendian.patch new file mode 100644 index 0000000..48d0f24 --- /dev/null +++ b/datrie-bigendian.patch @@ -0,0 +1,15 @@ +--- datrie-0.7.1/src/datrie.pyx 2018/03/15 17:07:17 1.1 ++++ datrie-0.7.1/src/datrie.pyx 2018/03/15 17:09:19 +@@ -1108,8 +1108,10 @@ + if length == 0: + length = cdatrie.alpha_char_strlen(key)*sizeof(cdatrie.AlphaChar) + cdef char* c_str = key +- return c_str[:length].decode('utf_32_le') +- ++ if sys.byteorder == "big": ++ return c_str[:length].decode('utf_32_be') ++ else: ++ return c_str[:length].decode('utf_32_le') + + def to_ranges(lst): + """ diff --git a/python-datrie.changes b/python-datrie.changes index 34c5075..c5a38e6 100644 --- a/python-datrie.changes +++ b/python-datrie.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Mar 15 18:10:19 CET 2018 - ro@suse.de + +- add datrie-bigendian.patch (bsc#1085526) + to use utf_32_be instead of utf_32_le on bigendian machines + ------------------------------------------------------------------- Tue Apr 11 10:17:10 UTC 2017 - jengelh@inai.de diff --git a/python-datrie.spec b/python-datrie.spec index daffc3b..8de291b 100644 --- a/python-datrie.spec +++ b/python-datrie.spec @@ -1,7 +1,7 @@ # # spec file for package python-datrie # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,6 +25,8 @@ License: LGPL-2.1+ Group: Development/Languages/Python Url: https://github.com/kmike/datrie Source: https://files.pythonhosted.org/packages/source/d/datrie/datrie-%{version}.tar.gz +Patch0: datrie-bigendian.patch +BuildRequires: %{python_module Cython >= 0.26.1} BuildRequires: %{python_module devel} BuildRequires: %{python_module hypothesis} BuildRequires: %{python_module pytest-runner} @@ -40,6 +42,10 @@ A trie data structure for Python (2.x and 3.x). Uses libdatrie. %prep %setup -q -n datrie-%{version} +%patch0 -p1 +pushd src +cython datrie.pyx +popd %build %python_build