From a9d415f9033914aef1bb0b1e10fbfef0214b5bab9a5668a6dd7810d688fe29b6 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 24 May 2022 22:08:18 +0000 Subject: [PATCH] - Update to 1.1.1: - Improvements: - Fixed issue with regex library by pinning dependencies to an earlier version - Extended support for Russian language dates starting with lowercase - Allowed to use_given_order for languages too - Fixed link to settings section - Defined UTF-8 encoding for Windows - Fixed directories creation error in CLI utils - Update to 1.1.0: - New features: - Support language detection based on langdetect, fastText, or a custom implementation - Add support for 'by ' - Sort default language list by internet usage - Improvements: - Improved support of Chinese - Improvements in search_dates - Make order of previous locales deterministic - Fix parsing with trailing space - Consider RETURN_TIME_AS_PERIOD for timestamp times - Exclude failing regex version - Ongoing work multithreading support - Add demo URL - QA: - Migrate pipelines from Travis CI to Github Actions - Use versioned CLDR data - Add a script to update table of supported languages and locales OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dateparser?expand=0&rev=14 --- dateparser-1.0.0.tar.gz | 3 --- dateparser-1.1.1.tar.gz | 3 +++ incompatible-regex-pattern.patch | 15 ++++++++++++ mark-network-tests.patch | 32 +++++++++++++++++++++++++ python-dateparser.changes | 40 +++++++++++++++++++++++++++++++ python-dateparser.spec | 41 +++++++++++++++++++++++++------- 6 files changed, 122 insertions(+), 12 deletions(-) delete mode 100644 dateparser-1.0.0.tar.gz create mode 100644 dateparser-1.1.1.tar.gz create mode 100644 incompatible-regex-pattern.patch create mode 100644 mark-network-tests.patch diff --git a/dateparser-1.0.0.tar.gz b/dateparser-1.0.0.tar.gz deleted file mode 100644 index d40a17d..0000000 --- a/dateparser-1.0.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:159cc4e01a593706a15cd4e269a0b3345edf3aef8bf9278a57dac8adf5bf1e4a -size 273807 diff --git a/dateparser-1.1.1.tar.gz b/dateparser-1.1.1.tar.gz new file mode 100644 index 0000000..b3d4621 --- /dev/null +++ b/dateparser-1.1.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:038196b1f12c7397e38aad3d61588833257f6f552baa63a1499e6987fa8d42d9 +size 284013 diff --git a/incompatible-regex-pattern.patch b/incompatible-regex-pattern.patch new file mode 100644 index 0000000..3932c80 --- /dev/null +++ b/incompatible-regex-pattern.patch @@ -0,0 +1,15 @@ +--- + dateparser/languages/locale.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/dateparser/languages/locale.py ++++ b/dateparser/languages/locale.py +@@ -169,7 +169,7 @@ class Locale: + if normalize: + value = list(map(normalize_unicode, value)) + pattern = '|'.join(sorted(value, key=len, reverse=True)) +- pattern = DIGIT_GROUP_PATTERN.sub(r'?P\d+', pattern) ++ pattern = pattern.replace(r'\d+', r'?P\d+') + pattern = re.compile(r'^(?:{})$'.format(pattern), re.UNICODE | re.IGNORECASE) + relative_dictionary[pattern] = key + return relative_dictionary diff --git a/mark-network-tests.patch b/mark-network-tests.patch new file mode 100644 index 0000000..c1d0516 --- /dev/null +++ b/mark-network-tests.patch @@ -0,0 +1,32 @@ +--- + tests/test_language_detect.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/tests/test_language_detect.py ++++ b/tests/test_language_detect.py +@@ -1,6 +1,8 @@ ++import os ++import unittest ++ + from datetime import datetime + from unittest.mock import Mock +-import unittest + + from parameterized import parameterized, param + +@@ -13,6 +15,7 @@ from dateparser.search import search_dat + detect_languages = Mock() + detect_languages.return_value = ["en"] + ++NO_NETWORK = int(os.environ.get('NO_NETWORK', 0)) == 1 + + class CustomLangDetectParserTest(unittest.TestCase): + def check_is_returned_list(self): +@@ -22,6 +25,7 @@ class CustomLangDetectParserTest(unittes + param(dt_string="14 June 2020", confidence_threshold=0.0), + param(dt_string="26 July 2021", confidence_threshold=0.0) + ]) ++ @unittest.skipIf(NO_NETWORK, "Test requires network access") + def test_custom_language_detect_fast_text(self, dt_string, confidence_threshold): + self.result = fast_text_detect_languages(dt_string, confidence_threshold) + self.check_is_returned_list() diff --git a/python-dateparser.changes b/python-dateparser.changes index ebe14f8..2875825 100644 --- a/python-dateparser.changes +++ b/python-dateparser.changes @@ -1,3 +1,43 @@ +------------------------------------------------------------------- +Tue May 24 18:05:23 UTC 2022 - Matej Cepl + +- Update to 1.1.1: + - Improvements: + - Fixed issue with regex library by pinning dependencies to + an earlier version + - Extended support for Russian language dates starting with + lowercase + - Allowed to use_given_order for languages too + - Fixed link to settings section + - Defined UTF-8 encoding for Windows + - Fixed directories creation error in CLI utils +- Update to 1.1.0: + - New features: + - Support language detection based on langdetect, fastText, + or a custom implementation + - Add support for 'by ' + - Sort default language list by internet usage + - Improvements: + - Improved support of Chinese + - Improvements in search_dates + - Make order of previous locales deterministic + - Fix parsing with trailing space + - Consider RETURN_TIME_AS_PERIOD for timestamp times + - Exclude failing regex version + - Ongoing work multithreading support + - Add demo URL + - QA: + - Migrate pipelines from Travis CI to Github Actions + - Use versioned CLDR data + - Add a script to update table of supported languages and + locales + - Sort 'skip' keys in yaml files + - Improve test coverage + - Code cleanup +- Add patches: + - incompatible-regex-pattern.patch (gh#scrapinghub/dateparser#1052) + - mark-network-tests.patch (gh#scrapinghub/dateparser#1059) + ------------------------------------------------------------------- Thu Mar 17 09:59:26 UTC 2022 - pgajdos@suse.com diff --git a/python-dateparser.spec b/python-dateparser.spec index b5884aa..41a257b 100644 --- a/python-dateparser.spec +++ b/python-dateparser.spec @@ -19,15 +19,23 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-dateparser -Version: 1.0.0 +Version: 1.1.1 Release: 0 Summary: Date parsing library designed to parse dates from HTML pages License: BSD-3-Clause URL: https://github.com/scrapinghub/dateparser Source: https://files.pythonhosted.org/packages/source/d/dateparser/dateparser-%{version}.tar.gz +# PATCH-FIX-UPSTREAM incompatible-regex-pattern.patch gh#scrapinghub/dateparser#1052 mcepl@suse.com +# use pattern compatible with the modern version of regex +Patch0: incompatible-regex-pattern.patch +# PATCH-FIX-UPSTREAM mark-network-tests.patch gh#scrapinghub/dateparser#1059 mcepl@suse.com +# mark test requiring network access +Patch1: mark-network-tests.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros +Requires: python-fasttext +Requires: python-langdetect Requires: python-python-dateutil Requires: python-pytz Requires: python-regex @@ -40,7 +48,9 @@ BuildArch: noarch BuildRequires: %{python_module GitPython} BuildRequires: %{python_module convertdate} BuildRequires: %{python_module coverage} +BuildRequires: %{python_module fasttext} BuildRequires: %{python_module jdatetime} +BuildRequires: %{python_module langdetect} BuildRequires: %{python_module parameterized} BuildRequires: %{python_module pytest} BuildRequires: %{python_module python-dateutil} @@ -50,38 +60,51 @@ BuildRequires: %{python_module ruamel.yaml} BuildRequires: %{python_module six} BuildRequires: %{python_module tzlocal} # /SECTION +Requires(post): update-alternatives +Requires(postun):update-alternatives %python_subpackages %description Date parsing library designed to parse dates from HTML pages %prep -%setup -q -n dateparser-%{version} +%autosetup -p1 -n dateparser-%{version} + # not py3 compatible and weird license of the imported module rm tests/test_hijri.py rm dateparser/calendars/hijri* # Requires files not shipped in PyPi tarball rm tests/test_dateparser_data_integrity.py +sed -i '1{/\/usr\/bin\/env python/d;}' \ + dateparser_scripts/update_supported_languages_and_locales.py + %build %python_build %install %python_install +%python_clone -a %{buildroot}%{_bindir}/dateparser-download %python_expand %fdupes %{buildroot}%{$python_sitelib} %check +export NO_NETWORK=1 %pytest +%post +%python_install_alternative dateparser-download + +%postun +%python_uninstall_alternative dateparser-download + %files %{python_files} %doc AUTHORS.rst README.rst %license LICENSE -%dir %{python_sitelib}/dateparser -%{python_sitelib}/dateparser/* -%dir %{python_sitelib}/dateparser_data -%{python_sitelib}/dateparser_data/* -%dir %{python_sitelib}/dateparser_scripts -%{python_sitelib}/dateparser_scripts/* -%{python_sitelib}/dateparser-%{version}-py*.egg-info +%python_alternative %{_bindir}/dateparser-download +%{python_sitelib}/dateparser +%{python_sitelib}/dateparser_cli +%{python_sitelib}/dateparser_data +%{python_sitelib}/dateparser_scripts +%{python_sitelib}/dateparser-%{version}*-info %changelog