# Created by pyp2rpm-1.1.0b
%global pypi_name CacheControl

%global common_description %{expand:
CacheControl is a port of the caching algorithms in httplib2 for use with
requests session object. It was written because httplib2's better support
for caching is often mitigated by its lack of thread safety. The same is
true of requests in terms of caching.}

Name:           python-%{pypi_name}
Version:        0.14.4
Release:        1
Summary:        httplib2 caching for requests

License:        Apache-2.0
URL:            https://github.com/psf/cachecontrol
Source0:        https://files.pythonhosted.org/packages/2d/f6/c972b32d80760fb79d6b9eeb0b3010a46b89c0b23cf6329417ff7886cd22/cachecontrol-0.14.4.tar.gz
BuildArch:      noarch

%description %{common_description}

%package -n     python3-%{pypi_name}
Summary:        httplib2 caching for requests

BuildRequires:  python3-cherrypy
BuildRequires:  python3-devel
BuildRequires:  python3-pytest
BuildRequires:  python3-lockfile
BuildRequires:  python3-mock
BuildRequires:  python3-msgpack
BuildRequires:  python3-redis
BuildRequires:  python3-requests
BuildRequires:  python3-setuptools
BuildRequires:  python3-setuptools_scm
BuildRequires:  python3-pip
BuildRequires:  python3-wheel
BuildRequires:  python3-flit
Requires:       python3-msgpack
Requires:       python3-requests

%python_extras_subpkg -n python3-%{pypi_name} -i %{python3_sitelib}/cachecontrol-*.dist-info filecache


%description -n python3-%{pypi_name}
CacheControl is a port of the caching algorithms in httplib2_ for use with
requests_ session object. It was written because httplib2's better support
for caching is often mitigated by its lack of threadsafety. The same is
true of requests in terms of caching.
This is the Python 3 build of CacheControl.


%prep
%setup -q -n cachecontrol-%{version}
# 0.14.4 sdist uses uv_build; rewrite to flit_core (uv_build not available as RPM here)
python3 <<'PY'
import re
from pathlib import Path
p = Path("pyproject.toml")
t = p.read_text(encoding="utf-8")
t = re.sub(
    r"\[build-system\].*?\n\n(?=\[project\])",
    '[build-system]\nrequires = ["flit_core >=3.11,<4"]\nbuild-backend = "flit_core.buildapi"\n\n'
    '[tool.flit.module]\nname = "cachecontrol"\n\n'
    '[tool.flit.sdist]\ninclude = ["tests/"]\n\n',
    t,
    count=1,
    flags=re.DOTALL,
)
p.write_text(t, encoding="utf-8")
PY
sed -i '/license-files/d' pyproject.toml
sed -i 's/license = "Apache-2.0"/license = \{ text = "Apache-2.0" \}/g' pyproject.toml
rm -rf cachecontrol.egg-info
find . -type f -exec touch {} +


%build
%pyproject_build

%install
%pyproject_install

%files -n python3-%{pypi_name}
%license LICENSE.txt
%doc README.rst
%{python3_sitelib}/cachecontrol
%{python3_sitelib}/cachecontrol-*.dist-info
%{_bindir}/doesitcache

%changelog
* Wed Apr 1 2026 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 0.14.4-1
- Update package with version 0.14.4
  Drop support for Python 3.9
  Explicitly support Python 3.14

* Wed Aug 13 2025 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 0.14.3-2
- Add extra package filecache for mkdocs-rss-plugin install deps

* Tue May 20 2025 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 0.14.3-1
- Update package with version 0.14.3
  Drop support for Python 3.8
  Eliminate a race condition when overwriting cache entries
  Fix a requests object leak when doing caching on a streamed response

* Fri Jul 26 2024 Hann <hannannan@kylinos.cn> - 0.14.0-1
- Update package to version 0.14.0
- Don't use the cache if the request has a Range header
- Fix document code case errors

* Sun Jun 25 2023 mengzhaoa <mengzhaoa@isoftstone.com> - 0.13.1-1
- introduce package CacheControl with version 0.13.1 to src openEuler