commit f5a5ec0c34cca56159fe16ed190d783f4ed9f311279d0b33899af8a6fe36931f Author: Markéta Machová Date: Tue Jul 8 08:32:45 2025 +0000 - Convert to libalternatives OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dateparser?expand=0&rev=41 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/dateparser-1.2.0.tar.gz b/dateparser-1.2.0.tar.gz new file mode 100644 index 0000000..e3e803d --- /dev/null +++ b/dateparser-1.2.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7975b43a4222283e0ae15be7b4999d08c9a70e2d378ac87385b1ccf2cffbbb30 +size 307260 diff --git a/mark-network-tests.patch b/mark-network-tests.patch new file mode 100644 index 0000000..65726bb --- /dev/null +++ b/mark-network-tests.patch @@ -0,0 +1,29 @@ +--- + tests/test_language_detect.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +Index: dateparser-1.2.0/tests/test_language_detect.py +=================================================================== +--- dateparser-1.2.0.orig/tests/test_language_detect.py ++++ dateparser-1.2.0/tests/test_language_detect.py +@@ -1,3 +1,4 @@ ++import os + import unittest + from datetime import datetime + from unittest.mock import Mock +@@ -17,6 +18,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): +@@ -28,6 +30,7 @@ class CustomLangDetectParserTest(unittes + 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 new file mode 100644 index 0000000..8e62ae8 --- /dev/null +++ b/python-dateparser.changes @@ -0,0 +1,256 @@ +------------------------------------------------------------------- +Tue Jul 8 08:32:18 UTC 2025 - Markéta Machová + +- Convert to libalternatives + +------------------------------------------------------------------- +Thu Dec 7 20:46:37 UTC 2023 - Dirk Müller + +- update to 1.2.0: + * New ``PREFER_MONTH_OF_YEAR`` setting (#1146) + * Absolute years in Russian are no longer being treated as a + number of years in the past (#1129) + * Cleanups and internal improvements: + * Removed the use of ``datetime.utcnow``, deprecated on Python + 3.12 (#1179) + * Applied Black formatting to the code base (#1158) + * Initial integration with OSSFuzz (#1198) + * Extended test cases (#1191) + +------------------------------------------------------------------- +Sat Oct 14 00:54:16 UTC 2023 - Matej Cepl + +- Clean up the SPEC file + +------------------------------------------------------------------- +Thu Sep 7 07:09:28 UTC 2023 - Dirk Müller + +- remove unneeded GitPython dependency + +------------------------------------------------------------------- +Fri Apr 21 12:24:07 UTC 2023 - Dirk Müller + +- add sle15_python_module_pythons (jsc#PED-68) + +------------------------------------------------------------------- +Sun Mar 26 20:00:19 UTC 2023 - Dirk Müller + +- update to 1.1.8: + * Improved date parsing for Chinese + * Improved date parsing for Czech + * Reorder language by popularity + * Fix leak of memory in cache + * Add support for "\d units later" + * Move modification in CLDR data to yaml + * Add support to use timezone via settings to get + PREFER_DATES_FROM result + +------------------------------------------------------------------- +Wed Feb 15 19:43:54 UTC 2023 - Dirk Müller + +- update to 1.1.7: + * Add an “ago” synonym for Arabic + * Improved date parsing for Czech + * Improved date parsing for Indonesian + +------------------------------------------------------------------- +Fri Jan 13 09:39:35 UTC 2023 - Dirk Müller + +- update to 1.1.6: + * Fix the bug where Monday is parsed as a month + * Prevent ReDoS in Spanish sentence splitting regex + +------------------------------------------------------------------- +Mon Jan 2 18:57:33 UTC 2023 - Dirk Müller + +- update to 1.1.5: + * Parse short versions of day, month, and year + * Add a test for “in 1d” + * Update languages_info + * Add a workaround for zipimporter not having exec_module before Python + 3.10 + * Stabilize tests at midnight + * Add a test case for French + * Improved support for languages such as Slovak, Indonesian, Hindi, German + and Japanese + * Recursively create a model home + * Replace regex sub with simple string replace + * Add Python 3.10, 3.11 support + * Drop support for Python 3.5, 3.6 versions +- drop incompatible-regex-pattern.patch (upstream) + +------------------------------------------------------------------- +Mon Nov 7 21:15:24 UTC 2022 - Yogalakshmi Arunachalam + +- Update to 1.1.3 + New features: + * Add support for fractional units (#876) + Improvements: + * Fix the returned datetime skipping a day with time+timezone input and PREFER_DATES_FROM = 'future' (#1002) + * Fix input translation breaking keep_formatting (#720) + * English: support "till date" (#1005) + * English: support “after” and “before” in relative dates (#1008) + Cleanups: + * Reorganize internal data (#1090) + * CI updates (#1088 + +------------------------------------------------------------------- +Thu Oct 27 22:51:58 UTC 2022 - Yogalakshmi Arunachalam + +- Update to 1.1.2 + * Added support for negative timestamp (#1060) + * Fixed PytzUsageWarning for Python versions >= 3.6 (#1062) + * Added support for dates with dots and spaces (#1028) + * Improved support for Ukrainian, Croatian and Russian (#1072, #1074, #1079, #1082, #1073, #1083) + * Added support for parsing Unix timestamps consistently regardless of timezones (#954) + * Improved tests (#1086) + +------------------------------------------------------------------- +Thu Aug 18 16:25:26 UTC 2022 - Ben Greiner + +- Clean requirements: no code coverage + +------------------------------------------------------------------- +Tue May 31 07:52:04 UTC 2022 - Markéta Machová + +- Do not collect test_search.py + * https://github.com/scrapinghub/dateparser/issues/1053 + +------------------------------------------------------------------- +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 + +- python-mock is actually not required for build + +------------------------------------------------------------------- +Wed Apr 7 06:37:13 UTC 2021 - Steve Kowalik + +- Update to 1.0.0: + * Breaking changes: + + Drop support for Python 2.7 and pypy (see #727, #744, #748, #749, #754, #755, #758, #761, #763, #764, #777 and #783) + + Now ``DateDataParser.get_date_data()`` returns a ``DateData`` object instead of a ``dict`` (see #778). + + From now wrong ``settings`` are not silenced and raise ``SettingValidationError`` (see #797) + + Now ``dateparser.parse()`` is deterministic and doesn't try previous locales. Also, ``DateDataParser.get_date_data()`` doesn't try the previous locales by default (see #781) + + Remove the ``'base-formats'`` parser (see #721) + + Extract the ``'no-spaces-time'`` parser from the ``'absolute-time'`` parser and make it an optional parser (see #786) + + Remove ``numeral_translation_data`` (see #782) + + Remove the undocumented ``SKIP_TOKENS_PARSER`` and ``FUZZY`` settings (see #728, #794) + + Remove support for using strings in ``date_formats`` (see #726) + + The undocumented ``ExactLanguageSearch`` class has been moved to the private scope and some internal methods have changed (see #778) + + Changes in ``dateparser.utils``: ``normalize_unicode()`` doesn't accept ``bytes`` as input and ``convert_to_unicode`` has been deprecated (see #749) + * New features: + + Add Python 3.9 support (see #732, #823) + + Detect hours separated with a period/dot (see #741) + + Add support for "decade" (see #762) + + Add support for the hijri calendar in Python ≥ 3.6 (see #718) + + Fix leap years when ``PREFER_DATES_FROM`` is set (see #738) + + Fix ``STRICT_PARSING`` setting in ``no-spaces-time`` parser (see #715) + + Consider ``RETURN_AS_TIME_PERIOD`` setting for ``relative-time`` parser (see #807) + + Parse the 24hr time format with meridian info (see #634) +- Remove extranous %dir for egg-info. + +------------------------------------------------------------------- +Thu Jul 30 01:41:23 UTC 2020 - Steve Kowalik + +- Update to 0.7.6: + * Rename ``scripts`` to ``dateparser_scripts`` to avoid name collisions + with modules from other packages or projects + * Add Python 3.8 support + * Implement a ``REQUIRE_PARTS`` setting + * Add support for subscript and superscript numbers + * Extended French support + * Extended German support +- Switch from nose to pytest. + +------------------------------------------------------------------- +Thu Apr 2 09:44:00 UTC 2020 - Marketa Calabkova + +- update to version 0.7.4 + * Fixed Python 2.7 tests + * Extended Norwegian support + * Implement a PARSERS setting + * Add support for `PREFER_DATES_FROM` in relative/freshness parser + * Add support for `PREFER_DAY_OF_MONTH` in base-formats parser + * Added UTC -00:00 as a valid offset + * Fix support for “one” + * Fix tokenizer for non recognized characters + * Prevent installing regex 2019.02.19 + * Added Hungarian language. + * Added setting, `STRICT_PARSING` to ignore incomplete dates. + * More simplifications for Russian and Ukrainian languages. + +------------------------------------------------------------------- +Sat Sep 21 19:14:39 UTC 2019 - Arun Persaud + +- specfile: + * be more precise in %file section + +- update to version 0.7.2: + * Features: + + Extended Czech support + + Added time to valid periods + + Added timezone information to dates found with search_dates() + + Support strings as date formats + * Improvements: + + Fixed Collections ABCs depreciation warning + + Fixed dates with trailing colons not being parsed + + Fixed date format override on any settings change + + Fixed parsing current weekday as past date, regardless of + settings + + Added UTC -2:30 as a valid offset + + Added Python 3.7 to supported versions, dropped support for + Python 3.3 and 3.4 + + Moved to importlib from imp where possible + + Improved support for Catalan + + Documentation improvements + +------------------------------------------------------------------- +Fri Sep 13 12:39:48 UTC 2019 - Tomáš Chvátal + +- Fix license +- Format with spec-cleaner +- Remove py2 only parts + +------------------------------------------------------------------- +Wed Apr 3 10:33:33 AM UTC 2019 - John Vandenberg + +- Initial spec for v0.7.1 diff --git a/python-dateparser.spec b/python-dateparser.spec new file mode 100644 index 0000000..0032326 --- /dev/null +++ b/python-dateparser.spec @@ -0,0 +1,104 @@ +# +# spec file for package python-dateparser +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%bcond_without libalternatives +%{?sle15_python_module_pythons} +Name: python-dateparser +Version: 1.2.0 +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 mark-network-tests.patch gh#scrapinghub/dateparser#1059 mcepl@suse.com +# mark test requiring network access +Patch1: mark-network-tests.patch +BuildRequires: %{python_module pip} +BuildRequires: %{python_module wheel} +BuildRequires: alts +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: alts +Requires: python-python-dateutil +Requires: python-pytz +Requires: python-regex +Requires: python-tzlocal +Recommends: convertdate +Recommends: python-fasttext +Recommends: python-langdetect +Recommends: python-ruamel.yaml +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module convertdate} +BuildRequires: %{python_module fasttext} +BuildRequires: %{python_module langdetect} +BuildRequires: %{python_module parameterized} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module python-dateutil} +BuildRequires: %{python_module pytz} +BuildRequires: %{python_module regex} +BuildRequires: %{python_module ruamel.yaml} +BuildRequires: %{python_module tzlocal} +# /SECTION +%python_subpackages + +%description +Date parsing library designed to parse dates from HTML pages + +%prep +%autosetup -p1 -n dateparser-%{version} + +# not py3 compatible and weird license of the imported module +rm tests/test_hijri.py +rm dateparser/calendars/hijri* + +sed -i '1{/\/usr\/bin\/env python/d;}' \ + dateparser_scripts/update_supported_languages_and_locales.py + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_clone -a %{buildroot}%{_bindir}/dateparser-download +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +export NO_NETWORK=1 +# Requires files not shipped in PyPI sdist +ignoretestfiles="--ignore tests/test_dateparser_data_integrity.py" +# https://github.com/scrapinghub/dateparser/issues/1053 +ignoretestfiles="$ignoretestfiles --ignore tests/test_search.py" +# overflow on 32bit +donttest="(not test_timezone_offset_calculation)" +%pytest -k "$donttest" $ignoretestfiles + +%pre +%python_libalternatives_reset_alternative dateparser-download + +%files %{python_files} +%doc AUTHORS.rst README.rst +%license LICENSE +%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