## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 3;
    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

%global _without_tests 1
# The tests BR httpx-socks, Requires python-socks.
# The tests of python-socks BR tiny-proxy.
# To break the loop when bootstrapping Python, we can disable the tests here.
%bcond tests 1

%global _description %{expand:
Simple proxy (SOCKS4(a), SOCKS5(h), HTTP tunnel) server built with anyio. It is
used for testing python-socks, aiohttp-socks and httpx-socks packages.}

%global forgeurl https://github.com/romis2012/tiny-proxy

Name:           python-tiny-proxy
Version:        0.2.1
Release:        %{autorelease}
Summary:        Simple proxy server (SOCKS4(a), SOCKS5(h), HTTP tunnel)

License:        Apache-2.0
%forgemeta
URL:            %{forgeurl}
Source:         %{forgesource}

BuildArch:      noarch

%description %_description

%package -n python3-tiny-proxy
Summary:        %{summary}
BuildRequires:  python3-devel

%description -n python3-tiny-proxy %_description

%prep
%autosetup -n tiny-proxy-%{version}
%forgesetup

# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
sed -r \
    -e 's/^(pytest-cov|flake8)\b/# &/' \
    -e 's/(==|,<).*//' \
    -e 's/^-e /# &/' \
    requirements-dev.txt |
  tee requirements-dev-filtered.txt

# Comment out to remove /usr/bin/env shebangs
# Can use something similar to correct/remove /usr/bin/python shebangs also
# find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'

%generate_buildrequires
%pyproject_buildrequires %{?with_tests:requirements-dev-filtered.txt}


%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files -l tiny_proxy

%check
%pyproject_check_import
%if %{with tests}
%{pytest}
%endif

%files -n python3-tiny-proxy -f %{pyproject_files}
%doc README.md
%doc examples/

%changelog
## START: Generated by rpmautospec
* Sun Jun 09 2024 Python Maint <python-maint@redhat.com> - 0.2.1-3
- Bootstrap for Python 3.13

* Fri Feb 09 2024 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.2.1-2
- chore: add packit

* Fri Feb 09 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.1-1
- Update to 0.2.1

* Fri Feb 09 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.0-9
- Assert that the .dist-info directory contains a license file

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Nov 05 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.2.0-4
- import sources (fixes rh#2241728)

* Sun Nov 05 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.2.0-3
- feat: ready for review

* Sun Nov 05 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com>
- wip

* Sun Nov 05 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com>
- init
## END: Generated by rpmautospec