%bcond_without tests

%global srcname setuptools_scm
%global python3_pkgversion 38

Name:           python38-setuptools_scm-epel
Version:        5.0.2
Release:        1%{?dist}
Summary:        Blessed package to manage your versions by SCM tags

License:        MIT
URL:            https://pypi.python.org/pypi/setuptools_scm
Source0:        %pypi_source

BuildArch:      noarch

%if %{with tests}
BuildRequires:  git-core
BuildRequires:  mercurial
%endif

%description
Setuptools_scm handles managing your python package versions in SCM metadata.
It also handles file finders for the supported SCMs.

%package -n python%{python3_pkgversion}-%{srcname}
Summary:        %{summary}
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-rpm-macros
BuildRequires:  python%{python3_pkgversion}-setuptools
%if %{with tests}
BuildRequires:  python%{python3_pkgversion}-pip
BuildRequires:  python%{python3_pkgversion}-pytest
BuildRequires:  python%{python3_pkgversion}-toml
%endif

%description -n python%{python3_pkgversion}-%{srcname}
Setuptools_scm handles managing your python package versions in SCM metadata.
It also handles file finders for the supported SCMs.

%{?python_extras_subpkg:%{python_extras_subpkg -n python3-setuptools_scm -i %{python3_sitelib}/%{srcname}-*.egg-info toml}}

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

%build
%py3_build

%install
%py3_install

%if %{with tests}
%check
# We don't really expect pyproject support on EL8
PYTHONPATH=%{buildroot}%{python3_sitelib} pytest-3.8 -v -k 'not test_pip_download and not test_pyproject_support and not test_pyproject_support_with_git and not test_pretend_version_named_pyproject_integration'
%endif

%files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{srcname}/
%{python3_sitelib}/%{srcname}-*.egg-info/

%changelog
* Fri Jun 24 2022 - Orion Poplawski <orion@nwra.com> - 5.0.2-1
- Build for EPEL8