# Run without tests by default
%bcond_with tests

%global srcname subprocess-tee

Name:    python-%{srcname}
Version: 0.3.5
Release: 1%{?dist}
Summary: A subprocess.run that works like tee, being able to display output in real time while still capturing it

URL:     https://github.com/pycontribs/subprocess-tee
Source:  %{pypi_source}
# See https://fedoraproject.org/wiki/Changes/DeprecatePythonMock for more info.
Patch0:  0000-remove-mock-dep.patch
License: MIT

BuildArch: noarch
BuildRequires: python3-devel

%global _description %{expand:
This package provides an drop-in alternative to subprocess.run that captures
the output while still printing it in real time, just the way tee does.
}

%description %{_description}

%package -n python3-%{srcname}
Summary: A subprocess.run that works like tee, being able to display output in real time while still capturing it

%description -n python3-%{srcname} %{_description}

%prep
%autosetup -p1 -n %{srcname}-%{version}

%generate_buildrequires
%if %{with tests}
# `-t` installs testing deps.
%pyproject_buildrequires -t
%else
#Testing deps are omitted when the rpm is built using `--without tests`.
%pyproject_buildrequires
%endif

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files subprocess_tee

%check
%if %{with tests}
%tox
%endif

%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE

%changelog
* Mon Nov 01 2021 Maxwell G <gotmax@e.email> - 0.3.5-1
- Update to version 0.3.5. Fixes rhbz#2003693.
- Implement new Fedora Python Packaging Guidelines
- Remove patch that's no longer needed

* Wed Sep 01 2021 Chedi Toueiti <chedi.toueiti@gmail.com> - 0.3.2-1
- Update to version 0.3.2

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.2.0-3
- Rebuilt for Python 3.10

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Sun Jan 03 2021 Chedi Toueiti <chedi.toueiti@gmail.com> - 0.2.0-1
- Update to version 0.2.0

* Wed Nov 25 2020 Chedi Toueiti <chedi.toueiti@gmail.com> - 0.1.5-1
- Initial commit