%define pypiname rfc6555 %global commit b62acec0fcec15406e24a2b363ad947be4e9cec7 %global shortcommit %(c=%{commit}; echo ${c:0:7}) # Set to 1 to use the official, archived project; # higher to use a newer unofficial fork. %global minor 1 %if %minor == 1 %define min_python_version 3.5 %else %define min_python_version 3.7 %endif %if 0%{!?mkrel:1} %define mkrel(c) %{1}%{?dist} %endif Name: python3-%{pypiname} Version: 0.%{minor}.0 %if %minor == 1 Release: %mkrel 3 %else Release: %mkrel 2 %endif Group: Development Summary: Python implementation of RFC 6555 License: Apache 2.0 URL: https://pypi.org/project/rfc6555/ %if %minor == 1 Source0: https://github.com/sethmlarson/rfc6555/releases/download/v%{version}/%{pypiname}-%{version}.tar.gz %else Source0: https://github.com/Julien00859/rfc6555/archive/%{commit}.zip#/%{pypiname}-%{commit}.zip %endif BuildArch: noarch %if %minor == 1 %global min_setuptools_version 0 %if 0%{!?pyproject_wheel:1} %define pyproject_wheel %py3_build %endif %if 0%{!?pyproject_install:1} %define pyproject_install %py3_install %endif %else %global min_setuptools_version 62.0 # It should use rpm_macro(pyproject_buildrequires) for portability, but that's # unversioned. BuildRequires: pyproject-rpm-macros >= 1.6.2 BuildRequires: unzip %endif BuildRequires: pkgconfig(python3) >= %min_python_version BuildRequires: python3dist(setuptools) >= %min_setuptools_version BuildRequires: python3dist(pip) BuildRequires: python3dist(wheel) Requires: python3 >= %min_python_version %if 0%{?pyproject_buildrequires:1} %generate_buildrequires %pyproject_buildrequires %endif %description Synchronous Python implementation of the Happy Eyeballs Algorithm described in RFC 6555. Provided with a single file and dead-simple API to allow easy vendoring and integration into other projects. %prep %if %minor == 1 %autosetup -p1 -n %{pypiname}-%{version} %else %autosetup -p1 -n %{pypiname}-%{commit} %endif %build %pyproject_wheel %install %pyproject_install %check %clean rm -f %{_builddir}/%{name}-%{version}*pyproject* rm -rf %{_buildir}/.pyproject-builddir %files %license LICENSE %doc *.rst %{python3_sitelib}/%{pypiname}.py %exclude %{python3_sitelib}/__pycache__ %{python3_sitelib}/%{pypiname}-%{version}*.*-info/ %changelog