python-dateutil/python-dateutil.spec
Kseniia Nivnia 20d2311525
Convert to %autorelease and %autochangelog
Resolves: RHEL-102837

[skip changelog]
2025-07-10 13:44:48 +01:00

103 lines
2.7 KiB
RPMSpec

%global modname dateutil
Name: python-%{modname}
Version: 2.8.2
Release: %autorelease
Epoch: 1
Summary: Powerful extensions to the standard datetime module
# According to the LICENSE file:
# - Apache-2.0 applies to all contributions after 2017-12-01, as well as
# all contributions that have been re-licensed.
# - BSD-3-Clause applies to all code, even that also covered by Apache-2.0
License: (Apache-2.0 AND BSD-3-Clause) OR BSD-3-Clause
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
# Backport the replacement for the deprecated in Python 3.12
# datetime.datetime.utcfromtimestamp()
Patch2: %{url}/commit/f2293200747fb03d56c6c5997bfebeabe703576f.patch
# when bootstrapping dateutil-freezegun, we cannot run tests
# on RHEL, we do not have or want all test dependencies
%bcond tests %{undefined rhel}
BuildArch: noarch
BuildRequires: make
BuildRequires: python3-sphinx
BuildRequires: python3-sphinx_rtd_theme
%global _description \
The dateutil module provides powerful extensions to the standard datetime\
module available in Python.
%description %_description
%package -n python3-%{modname}
Summary: %summary
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-setuptools_scm
# Runtime deps
BuildRequires: python3-six
%if %{with tests}
BuildRequires: python3-freezegun
BuildRequires: python3-hypothesis
BuildRequires: python3-pytest
%endif
Requires: tzdata
%{?python_provide:%python_provide python3-%{modname}}
%description -n python3-%{modname} %_description
%package doc
Summary: API documentation for python-dateutil
%description doc
This package contains %{summary}.
%prep
%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
%patch -P1 -p2
popd
%patch -P2 -p2
iconv --from=ISO-8859-1 --to=UTF-8 NEWS > NEWS.new
mv NEWS.new NEWS
%build
%py3_build
make -C docs html
%install
%py3_install
%check
%if %{with tests}
%{__python3} -m pytest -W ignore::pytest.PytestUnknownMarkWarning
%else
%py3_check_import dateutil dateutil.easter dateutil.parser dateutil.relativedelta dateutil.rrule dateutil.tz dateutil.utils dateutil.zoneinfo
%endif
%files -n python3-%{modname}
%license LICENSE
%doc NEWS README.rst
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/*.egg-info
%files doc
%license LICENSE
%doc docs/_build/html
%changelog
%autochangelog