## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

Name:           python-tox-uv
Version:        1.16.1
Release:        %autorelease
Summary:        Integration of uv with tox

License:        MIT
URL:            https://github.com/tox-dev/tox-uv
Source:         %{pypi_source tox_uv}

# as with python-tox, those tests run on the CI only, as they need internet access
%bcond ci_tests 0

BuildArch:      noarch
BuildRequires:  python3-devel

%global _description %{expand:
tox-uv is a tox plugin, which replaces virtualenv and pip with uv in your tox
environments. Note that you will get both the benefits (performance)
or downsides (bugs) of uv.

Installing this package changes the behavior of tox.
It also complicates usage of tox with a Python version not supported by uv.
Use `tox --runner virtualenv` to disable this plugin.}

%description %_description

%package -n     python3-tox-uv
Summary:        %{summary}

%description -n python3-tox-uv %_description


%prep
%autosetup -p1 -n tox_uv-%{version}
# Remove unpackaged (devpi-process) and coverage test dependencies
sed -Ei '/"(devpi-process|covdefaults|diff-cover|pytest-cov)/d' pyproject.toml
# Relax some build/test dependencies
sed -Ei 's/"(hatchling|pytest(-mock)?)>=[^"]+"/"\1"/' pyproject.toml
# And a runtime dependency, where we must be more careful
sed -i 's/"packaging>=24.1"/"packaging>=23.1"/' pyproject.toml


%generate_buildrequires
%pyproject_buildrequires -g test


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files -l tox_uv


%check
# only works with the package actually installed
k="${k-}${k+ and }not test_tox_version"

%if %{without ci_tests}
# requires internet
k="${k-}${k+ and }not test_uv_install"
k="${k-}${k+ and }not test_uv_package_editable_legacy"
k="${k-}${k+ and }not test_uv_package_requirements"
k="${k-}${k+ and }not test_uv_python_set"
%endif

%pytest -v "${k:+-k $k}"


%files -n python3-tox-uv -f %{pyproject_files}


%changelog
## START: Generated by rpmautospec
* Thu Dec 05 2024 Miro Hrončok <miro@hroncok.cz> - 1.16.1-2
- Remove a superfluous test dependency on diff-cover

* Thu Dec 05 2024 Miro Hrončok <miro@hroncok.cz> - 1.16.1-1
- Update to 1.16.1
- Fixes: rhbz#2322800

* Fri Oct 25 2024 Miro Hrončok <miro@hroncok.cz> - 1.15.0-2
- Description: Mention a way to disable tox-uv

* Fri Oct 11 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.15.0-1
- Update to 1.15.0 (close RHBZ#2318120)

* Fri Oct 11 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.13.0-1
- Update to 1.13.0 (close RHBZ#2318005)

* Wed Oct 09 2024 Miro Hrončok <miro@hroncok.cz> - 1.11.4-1
- Initial import
- Fixes: rhbz#2317589
## END: Generated by rpmautospec