From 97e7c1973c42086a65d703b6296e0e5eb4829032 Mon Sep 17 00:00:00 2001 From: mgb01105731 Date: Mon, 27 Feb 2023 10:55:52 +0800 Subject: [PATCH] optimise dependency --- ...63158b7f981fc6d70a869680451bdfd8d848.patch | 46 +++++++++++++++++++ python-dateutil.spec | 30 +++++++++--- 2 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 2bdd63158b7f981fc6d70a869680451bdfd8d848.patch diff --git a/2bdd63158b7f981fc6d70a869680451bdfd8d848.patch b/2bdd63158b7f981fc6d70a869680451bdfd8d848.patch new file mode 100644 index 0000000..c7a078c --- /dev/null +++ b/2bdd63158b7f981fc6d70a869680451bdfd8d848.patch @@ -0,0 +1,46 @@ +From 2bdd63158b7f981fc6d70a869680451bdfd8d848 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20Kul=C3=ADk?= +Date: Thu, 10 Feb 2022 10:28:42 +0100 +Subject: [PATCH] Remove deprecated pytest.warns(None) from test_internals.py + +--- + tests/test_internals.py | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/tests/test_internals.py b/tests/test_internals.py +index 530813147..b32e6723f 100644 +--- a/tests/test_internals.py ++++ b/tests/test_internals.py +@@ -9,6 +9,7 @@ + + import sys + import pytest ++import warnings + + from dateutil.parser._parser import _ymd + from dateutil import tz +@@ -65,18 +66,17 @@ def test_parser_parser_private_not_warns(): + from dateutil.parser._parser import _timelex, _tzparser + from dateutil.parser._parser import _parsetz + +- with pytest.warns(None) as recorder: ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") + _tzparser() +- assert len(recorder) == 0 + +- with pytest.warns(None) as recorder: ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") + _timelex('2014-03-03') + +- assert len(recorder) == 0 +- +- with pytest.warns(None) as recorder: ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") + _parsetz('+05:00') +- assert len(recorder) == 0 + + + @pytest.mark.tzstr diff --git a/python-dateutil.spec b/python-dateutil.spec index a883e40..7a6944c 100644 --- a/python-dateutil.spec +++ b/python-dateutil.spec @@ -1,5 +1,5 @@ %global modname dateutil -%define anolis_release 1 +%define anolis_release 2 Name: python-%{modname} Version: 2.8.2 Release: %{anolis_release}%{?dist} @@ -15,6 +15,13 @@ License: BSD or (BSD and ASL 2.0) URL: https://github.com/dateutil/dateutil Source: %{pypi_source} +# Remove deprecated pytest.warns(None) from test_internals.py +# +# Fixes: +# python-dateutil fails to build with pytest 7 +# https://bugzilla.redhat.com/show_bug.cgi?id=2059950 +Patch1: %{url}/commit/2bdd63158b7f981fc6d70a869680451bdfd8d848.patch + # when bootstrapping dateutil-freezegun, we cannot run tests %bcond_without tests @@ -32,8 +39,6 @@ module available in Python. %package -n python3-%{modname} Summary: %summary BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-setuptools_scm %if %{with tests} BuildRequires: python3-freezegun BuildRequires: python3-hypothesis @@ -51,16 +56,24 @@ Summary: API documentation for python-dateutil This package contains %{summary}. %prep -%autosetup +%autosetup -N +# the tests were moved outside of %%{modname} directory upstream after 2.8.2 +# so we apply the patch with new paths from within it +pushd %{modname}/test +%patch1 -p2 +popd iconv --from=ISO-8859-1 --to=UTF-8 NEWS > NEWS.new mv NEWS.new NEWS +%generate_buildrequires +%pyproject_buildrequires + %build -%py3_build +%pyproject_wheel make -C docs html %install -%py3_install +%pyproject_install %if %{with tests} %check @@ -71,12 +84,15 @@ make -C docs html %license LICENSE %doc NEWS README.rst %{python3_sitelib}/%{modname}/ -%{python3_sitelib}/*.egg-info +%{python3_sitelib}/python_dateutil-%{version}.dist-info/ %files doc %license LICENSE %doc docs/_build/html %changelog +* Mon Feb 27 2023 mgb01105731 - 2.8.2-2 +- optimise dependency + * Thu Mar 10 2022 zl01087097 - 2.8.2-1 - upstream version 2.8.2 -- Gitee