2591a5a
%if 0%{?rhel}
2591a5a
%if 0%{?el9}
2591a5a
# Skip tests on EL9 due to missing dependencies
2591a5a
%bcond_with check
2591a5a
%else
2591a5a
%bcond_without check
2591a5a
%endif
2591a5a
# pypandoc is an optional dependency and is not available in EPEL
2591a5a
%bcond_with doc
2591a5a
%else
2591a5a
%bcond_without check
2591a5a
%bcond_without doc
2591a5a
%endif
64eb008
64eb008
# Created by pyp2rpm-3.3.5
64eb008
%global pypi_name dcrpm
64eb008
64eb008
Name:           python-%{pypi_name}
6374f4e
Version:        0.6.3
21509eb
Release:        %autorelease
64eb008
Summary:        A tool to detect and correct common issues around RPM database corruption
64eb008
64eb008
License:        GPLv2
64eb008
URL:            https://github.com/facebookincubator/dcrpm
6374f4e
Source:         %{pypi_source}
64eb008
BuildArch:      noarch
64eb008
64eb008
BuildRequires:  python3-devel
64eb008
BuildRequires:  python3dist(psutil)
64eb008
BuildRequires:  python3dist(setuptools)
2591a5a
%if %{with check}
2591a5a
BuildRequires:  python3dist(pytest)
64eb008
BuildRequires:  python3dist(testslide)
64eb008
BuildRequires:  dnf
64eb008
BuildRequires:  libdb-utils
64eb008
%endif
2591a5a
%if %{with doc}
2591a5a
BuildRequires:  python3dist(pypandoc)
2591a5a
%endif
64eb008
2591a5a
%global _description %{expand:
64eb008
dcrpm is a tool to detect and correct common issues around RPM database
2591a5a
corruption.}
2591a5a
2591a5a
%description %{_description}
2591a5a
64eb008
64eb008
%package -n     %{pypi_name}
64eb008
Summary:        %{summary}
b72e111
%if 0%{?fedora} < 33 || 0%{?rhel} < 9
b72e111
%py_provides    python3-%{pypi_name}
b72e111
%endif
64eb008
64eb008
Requires:       python3dist(psutil)
64eb008
Requires:       python3dist(setuptools)
64eb008
Requires:       lsof
64eb008
Recommends:     libdb-utils
2591a5a
2591a5a
%description -n %{pypi_name} %{_description}
2591a5a
64eb008
64eb008
%prep
64eb008
%autosetup -n %{pypi_name}-%{version} -p1
64eb008
# Remove unnecessary shebang
64eb008
sed -e '\|#!/usr/bin/env python|d' -i dcrpm/*.py
64eb008
# Remove bundled egg-info
64eb008
rm -rf %{pypi_name}.egg-info
6374f4e
%if 0%{?el8}
6374f4e
# needed with setuptools < 40.9.0
6374f4e
mv legacy_setup.py setup.py
6374f4e
%endif
64eb008
2591a5a
64eb008
%build
64eb008
%py3_build
64eb008
2591a5a
64eb008
%install
64eb008
%py3_install
64eb008
2591a5a
64eb008
%check
2591a5a
%py3_check_import %{pypi_name}
2591a5a
%if %{with check}
2591a5a
%pytest -v
64eb008
%endif
64eb008
2591a5a
64eb008
%files -n %{pypi_name}
64eb008
%license LICENSE
64eb008
%doc README.md CONTRIBUTING.md CODE_OF_CONDUCT.md
64eb008
%doc HISTORY.md MANUAL_RPM_CLEANUP.md
64eb008
%{_bindir}/dcrpm
64eb008
%{python3_sitelib}/%{pypi_name}
64eb008
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
64eb008
2591a5a
64eb008
%changelog
21509eb
%autochangelog