%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 2 %define min_python_version 3.7 %if 0%{!?mkrel:1} %define mkrel(c) %{1}%{?dist} %endif Name: python3-%{pypiname} Version: 0.%{minor}.0 Release: %mkrel 4 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 0%{!?pyproject_wheel:1} %define pyproject_wheel pyproject-build -nwx %endif %if 0%{!?pyproject_install:1} # The environment variable is only needed for 0.1.0, which lacks a pyproject.toml file. # 0.2.0 has that file and so automatically uses PEP 517. %define pyproject_install PIP_USE_PEP517=true pip install --disable-pip-version-check--ignore-installed --no-deps --prefix=%{buildroot}%{_prefix} . %endif %if %minor == 1 %global min_setuptools_version 0 %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 or python3dist(build) >= 1.0) 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 %else BuildRequires: python3dist(build) %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 rm -rf %{buildroot} %files %license LICENSE %doc *.rst %{python3_sitelib}/%{pypiname}.py %exclude %{python3_sitelib}/__pycache__ %{python3_sitelib}/%{pypiname}-%{version}*.*-info/ %changelog