%global _name gpep517

Name:           python-%{_name}
Version:        15
Release:        1%{?dist}
Summary:        Minimal backend script to aid installing Python packages through PEP 517-compliant build systems

%bcond_without tests

# colorlog.py is "copied from Tornado", Apache licensed
License:        MIT
URL:            https://github.com/projg2/gpep517
Source0:        https://github.com/mgorny/gpep517/archive/v%{version}/gpep517-v%{version}.tar.gz
Source1:        gpep517
BuildArch:      noarch

#Patch0:         default-bytecode-levels.patch

BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  pyproject-rpm-macros


%description
%{summary}.


%package -n     python%{python3_pkgversion}-%{_name}
Summary:        %{summary}
Requires:  python%{python3_pkgversion}-installer

%{?python_provide:%python_provide python%{python3_pkgversion}-%{_name}}



%description -n python%{python3_pkgversion}-%{_name}
%{summary}.


%prep
%autosetup -n %{_name}-%{version}

sed -i '/tomli/d' pyproject.toml

%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files %{_name}

install -p -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/gpep517
sed -i 's/python3/python%{python3_pkgversion}/' %{buildroot}%{_bindir}/gpep517


%files -n python%{python3_pkgversion}-%{_name} -f %{pyproject_files}
%license LICENSE
%doc README.rst
%{_bindir}/gpep517


%changelog
* Thu Feb  8 2024 Raven <raven@sysadmins.ws> - 15-1
- Initial package