7cabe11
# Created by pyp2rpm-3.3.5
7cabe11
%if 0%{?rhel}
7cabe11
%bcond_with docs
7cabe11
%else
7cabe11
%bcond_without docs
7cabe11
%endif
7cabe11
%bcond_without tests
7cabe11
7cabe11
%global pypi_name drgn
7cabe11
fb29a14
%global _description %{expand:
7cabe11
drgn (pronounced "dragon") is a debugger with an emphasis on programmability.
7cabe11
drgn exposes the types and variables in a program for easy, expressive
7cabe11
scripting in Python.}
7cabe11
7cabe11
Name:           python-%{pypi_name}
3b59be3
Version:        0.0.24
126ea63
Release:        %autorelease
c368529
Summary:        Programmable debugger
7cabe11
8431cbb
License:        LGPL-2.1-or-later
7cabe11
URL:            https://github.com/osandov/drgn
7cabe11
Source0:        %{pypi_source}
7cabe11
7cabe11
BuildRequires:  python3-devel
7cabe11
BuildRequires:  python3dist(setuptools)
7cabe11
%if %{with docs}
7cabe11
BuildRequires:  sed
7cabe11
BuildRequires:  python3dist(sphinx)
7cabe11
BuildRequires:  python3-docs
7cabe11
%endif
7cabe11
%if %{with tests}
7cabe11
BuildRequires:  python3dist(pytest)
7cabe11
%endif
7cabe11
BuildRequires:  gcc-c++
7cabe11
BuildRequires:  make
7cabe11
BuildRequires:  bzip2-devel
7cabe11
BuildRequires:  elfutils-devel
7cabe11
BuildRequires:  libkdumpfile-devel
7cabe11
BuildRequires:  zlib-devel
7cabe11
BuildRequires:  xz-devel
1b69c1e
# These are needed when building from git snapshots
1b69c1e
BuildRequires:  autoconf
1b69c1e
BuildRequires:  automake
1b69c1e
BuildRequires:  libtool
7cabe11
fb29a14
%description %{_description}
7cabe11
7cabe11
%package -n     %{pypi_name}
7cabe11
Summary:        %{summary}
7cabe11
fb29a14
%description -n %{pypi_name} %{_description}
7cabe11
7cabe11
%if %{with docs}
7cabe11
%package -n %{pypi_name}-doc
7cabe11
Summary:        %{pypi_name} documentation
7cabe11
BuildArch:      noarch
7cabe11
Requires:       python3-docs
7cabe11
fb29a14
%description -n %{pypi_name}-doc %{_description}
fb29a14
fb29a14
This package contains additional documentation for %{pypi_name}.
7cabe11
%endif
7cabe11
7cabe11
%prep
7cabe11
%autosetup -n %{pypi_name}-%{version} -p1
7cabe11
# Remove bundled egg-info
7cabe11
rm -rf %{pypi_name}.egg-info
7cabe11
%if %{with docs}
7cabe11
# Use local intersphinx inventory
7cabe11
sed -r \
7cabe11
    -e 's|https://docs.python.org/3|%{_docdir}/python3-docs/html|' \
7cabe11
    -i docs/conf.py
7cabe11
%endif
1b69c1e
# Ensure version is always set, even when building from git snapshots
1b69c1e
if [ ! -f drgn/internal/version.py ]; then
1b69c1e
  echo '__version__ = "%{version}"' > drgn/internal/version.py
1b69c1e
fi
7cabe11
7cabe11
%build
7cabe11
# verbose build
7cabe11
V=1 %py3_build
7cabe11
7cabe11
%if %{with docs}
7cabe11
# generate html docs
7cabe11
PYTHONPATH=${PWD} sphinx-build-3 docs html
7cabe11
# remove the sphinx-build leftovers
7cabe11
rm -rf html/.{doctrees,buildinfo}
7cabe11
%endif
7cabe11
7cabe11
%install
7cabe11
%py3_install
7cabe11
mkdir -p %{buildroot}%{_datadir}/drgn
8431cbb
cp -PR contrib tools %{buildroot}%{_datadir}/drgn
7cabe11
7cabe11
%if %{with tests}
7cabe11
%check
7cabe11
%pytest
7cabe11
%endif
7cabe11
7cabe11
%files -n %{pypi_name}
7cabe11
%license COPYING
8431cbb
%license LICENSES
7cabe11
%doc README.rst
7cabe11
%{_bindir}/drgn
7cabe11
%{_datadir}/drgn
7cabe11
%{python3_sitearch}/_%{pypi_name}.pyi
7cabe11
%{python3_sitearch}/_%{pypi_name}.cpython*.so
7cabe11
%{python3_sitearch}/%{pypi_name}
7cabe11
%{python3_sitearch}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
7cabe11
7cabe11
%if %{with docs}
7cabe11
%files -n %{pypi_name}-doc
7cabe11
%license COPYING
8431cbb
%license LICENSES
7cabe11
%doc html
7cabe11
%endif
7cabe11
7cabe11
%changelog
126ea63
%autochangelog