diff --git a/python-PyICU.changes b/python-PyICU.changes index 228c6b6..e0e0b4f 100644 --- a/python-PyICU.changes +++ b/python-PyICU.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Apr 28 08:06:12 UTC 2021 - Steve Kowalik + +- Add patch support-icu-69.patch: + * Support ICU 69 + ------------------------------------------------------------------- Mon Dec 14 16:27:25 UTC 2020 - Callum Farmer diff --git a/python-PyICU.spec b/python-PyICU.spec index 0cf5826..c8edf64 100644 --- a/python-PyICU.spec +++ b/python-PyICU.spec @@ -1,7 +1,7 @@ # # spec file for package python-PyICU # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,6 +26,8 @@ License: MIT Group: Development/Libraries/Python URL: https://github.com/ovalhub/pyicu Source0: https://files.pythonhosted.org/packages/source/P/PyICU/%{modname}-%{version}.tar.gz +# PATCH-FIX-UPSTREAM: Support for ICU 69 commited upstream, spread over 2 commits +Patch0: support-icu-69.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} @@ -46,6 +48,7 @@ library (ICU). %prep %setup -q -n %{modname}-%{version} +%autopatch -p1 %build export CXXFLAGS="%{optflags} -fno-strict-aliasing" diff --git a/support-icu-69.patch b/support-icu-69.patch new file mode 100644 index 0000000..9bfeb7b --- /dev/null +++ b/support-icu-69.patch @@ -0,0 +1,100 @@ +From 15d2ba67677369aae8b0964f18e9cdbf70a414b2 Mon Sep 17 00:00:00 2001 +From: ovalhub <11970237+ovalhub@users.noreply.github.com> +Date: Fri, 26 Mar 2021 12:53:37 -0700 +Subject: [PATCH] fix build and test failures with icu 69rc + +--- + numberformat.cpp | 6 ++++++ + test/test_DateTimeParserGenerator.py | 1 - + test/test_NumberFormatter.py | 16 ++++++++++++---- + 3 files changed, 18 insertions(+), 5 deletions(-) + +diff --git a/numberformat.cpp b/numberformat.cpp +index a5deba1..5a5e6ee 100644 +--- a/numberformat.cpp ++++ b/numberformat.cpp +@@ -597,10 +597,12 @@ DECLARE_BY_VALUE_TYPE(FormattedNumber, t_formattednumber, FormattedValue, + /* FormattedNumberRange */ + /* t_formattednumberrange declared in numberformat.h */ + ++#if U_ICU_VERSION_HEX <= VERSION_HEX(69, 0, 0) + static PyObject *t_formattednumberrange_getFirstDecimal( + t_formattednumberrange *self); + static PyObject *t_formattednumberrange_getSecondDecimal( + t_formattednumberrange *self); ++#endif + static PyObject *t_formattednumberrange_getIdentityResult( + t_formattednumberrange *self); + #if U_ICU_VERSION_HEX >= VERSION_HEX(68, 0, 0) +@@ -609,8 +611,10 @@ static PyObject *t_formattednumberrange_getDecimalNumbers( + #endif + + static PyMethodDef t_formattednumberrange_methods[] = { ++#if U_ICU_VERSION_HEX <= VERSION_HEX(69, 0, 0) + DECLARE_METHOD(t_formattednumberrange, getFirstDecimal, METH_NOARGS), + DECLARE_METHOD(t_formattednumberrange, getSecondDecimal, METH_NOARGS), ++#endif + DECLARE_METHOD(t_formattednumberrange, getIdentityResult, METH_NOARGS), + #if U_ICU_VERSION_HEX >= VERSION_HEX(68, 0, 0) + DECLARE_METHOD(t_formattednumberrange, getDecimalNumbers, METH_NOARGS), +@@ -5208,6 +5212,7 @@ static PyObject *t_formattednumber_getOutputUnit(t_formattednumber *self) + + /* FormattedNumberRange */ + ++#if U_ICU_VERSION_HEX <= VERSION_HEX(69, 0, 0) + static PyObject *t_formattednumberrange_getFirstDecimal( + t_formattednumberrange *self) + { +@@ -5227,6 +5232,7 @@ static PyObject *t_formattednumberrange_getSecondDecimal( + + return PyUnicode_FromUnicodeString(&u); + } ++#endif + + static PyObject *t_formattednumberrange_getIdentityResult( + t_formattednumberrange *self) +diff --git a/test/test_DateTimeParserGenerator.py b/test/test_DateTimeParserGenerator.py +index 6d37c22..ef9a00f 100644 +--- a/test/test_DateTimeParserGenerator.py ++++ b/test/test_DateTimeParserGenerator.py +@@ -63,7 +63,6 @@ class TestDateTimePatternGenerator(TestCase): + else: + self.assertEqual(sdf.format(self.date), u'09. von mai, 17:30') + self.assertEqual(sdf.toPattern(), u"dd'. von' MMMM, HH:mm") +- + + def testGetBestPattern(self): + """Test a few different languages and common patterns.""" +diff --git a/test/test_NumberFormatter.py b/test/test_NumberFormatter.py +index a69f39b..8c85005 100644 +--- a/test/test_NumberFormatter.py ++++ b/test/test_NumberFormatter.py +@@ -161,13 +161,21 @@ class TestNumberRangeFormatter(TestCase): + self.assertEqual(str(value), u'0,333-0,25') + self.assertEqual(repr(value), u'') + +- self.assertEqual(value.getFirstDecimal(), u'3.33E-1') +- self.assertEqual(value.getSecondDecimal(), u'2.5E-1') ++ if ICU_VERSION < '69.0': ++ self.assertEqual(value.getFirstDecimal(), u'3.33E-1') ++ self.assertEqual(value.getSecondDecimal(), u'2.5E-1') ++ self.assertEqual( ++ [(x.getStart(), x.getLimit()) for x in value], ++ [(0, 1), (1, 2), (2, 5), (6, 7), (7, 8), (8, 10)]) ++ else: ++ self.assertEqual( ++ [(x.getStart(), x.getLimit()) for x in value], ++ [(0, 5), (0, 1), (1, 2), (2, 5), (6, 10), (6, 7), (7, 8), ++ (8, 10)]) ++ + if ICU_VERSION >= '68.0': + self.assertEqual(value.getDecimalNumbers(), (b'0.333', b'0.25')) + +- self.assertEqual([(x.getStart(), x.getLimit()) for x in value], +- [(0, 1), (1, 2), (2, 5), (6, 7), (7, 8), (8, 10)]) + + + if __name__ == "__main__": +-- +GitLab +