c5ee337
# Sphinx-generated HTML documentation is not suitable for packaging; see
c5ee337
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
c5ee337
#
c5ee337
# We can generate PDF documentation as a substitute.
c5ee337
%bcond doc_pdf 1
c5ee337
47fa238
Name:           python-helpdev
04be600
Version:        0.7.1
ad4ad4e
Release:        %autorelease
47fa238
Summary:        HelpDev – Extracts information about the Python environment easily
47fa238
47fa238
# The GitLab archive contains tests and documentation; the PyPI sdist doesn’t.
47fa238
%global forgeurl https://gitlab.com/dpizetta/helpdev
47fa238
%global tag v%{version}
47fa238
%forgemeta
4523c68
a18c920
# The entire source is (SPDX) MIT, except for “Images,” which are CC-BY-4.0 (an
a18c920
# allowed license for content). The images in question seem to be only the
a18c920
# contents of docs/images/, which are not incorporated in the helpdev.pdf file
a18c920
# in the -doc subpackage (but are not present in any other subpackages).
4523c68
License:        MIT
47fa238
URL:            %{forgeurl}
47fa238
Source:         %{forgesource}
47fa238
fcf0ed4
# Remove useless shebang lines from package modules
fcf0ed4
# https://gitlab.com/dpizetta/helpdev/-/merge_requests/4
fcf0ed4
Patch:          %{forgeurl}/-/merge_requests/4.patch
fcf0ed4
4523c68
BuildArch:      noarch
4523c68
 
4523c68
BuildRequires:  python3-devel
4523c68
47fa238
# Selected test dependencies from req-test.txt; most entries in that file are
47fa238
# for linters, code coverage, etc. Note that we use pytest directly because tox
47fa238
# doesn’t add anything useful for us in this package.
47fa238
BuildRequires:  %{py3_dist pytest}
47fa238
c9a0594
# The generated man page is pretty good in this case; it’s probably not worth
c9a0594
# hand-writing one.
c9a0594
BuildRequires:  help2man
c9a0594
c5ee337
%if %{with doc_pdf}
c5ee337
# We don’t generate documentation dependencies from req-doc.txt because:
c5ee337
# - There is extra cruft in there (setuptools, wheel, etc.): no big deal
c5ee337
# - We don’t need sphinx_rtd_theme because we aren’t building HTML
c5ee337
# - We need to specify the extra BR’s for building LaTeX/PDF manually anyway
c5ee337
BuildRequires:  make
c5ee337
BuildRequires:  python3dist(sphinx)
c5ee337
BuildRequires:  python3-sphinx-latex
c5ee337
BuildRequires:  latexmk
c5ee337
%endif
c5ee337
47fa238
%global common_description %{expand:
47fa238
Helping users and developers to get information about the environment to report
47fa238
bugs or even test your system without spending a day on it. It can get
47fa238
information about hardware, OS, paths, Python distribution and packages,
47fa238
including Qt-things.}
47fa238
47fa238
%description %{common_description}
47fa238
4523c68
47fa238
%package -n python3-helpdev
4523c68
Summary:        %{summary}
4523c68
04be600
Recommends:     python3-helpdev+memory_info = %{version}-%{release}
04be600
47fa238
%description -n python3-helpdev %{common_description}
47fa238
4523c68
04be600
%pyproject_extras_subpkg -n python3-helpdev memory_info
04be600
04be600
c5ee337
%package doc
c5ee337
Summary:        Documentation and examples for HelpDev
c5ee337
a18c920
# The entire source is (SPDX) MIT, except for images incorporated in
a18c920
# helpdev.pdf, which are CC-BY-4.0; see also the more verbose comment above the
a18c920
# base package License field.
a18c920
License:        MIT AND CC-BY-4.0
a18c920
c5ee337
%description doc
c5ee337
This package includes documentation and examples for HelpDev.
c5ee337
c5ee337
4523c68
%prep
f245c78
%autosetup -p1 %{forgesetupargs}
4523c68
47fa238
47fa238
%generate_buildrequires
04be600
%pyproject_buildrequires -x memory_info
47fa238
47fa238
4523c68
%build
47fa238
%pyproject_wheel
47fa238
c5ee337
%if %{with doc_pdf}
c5ee337
PYTHONPATH="${PWD}" %make_build -C docs latex \
c5ee337
    SPHINXOPTS='-j%{?_smp_build_ncpus}'
c5ee337
%make_build -C build/docs/latex LATEXMKOPTS='-quiet'
c5ee337
%endif
c5ee337
4523c68
4523c68
%install
47fa238
%pyproject_install
2f508bb
%pyproject_save_files -l helpdev
47fa238
c9a0594
# Generating the man page in %%install allows us to use the installed entry
c9a0594
# point; horrible hacks would be required to do this in %%build.
c9a0594
install -d '%{buildroot}%{_mandir}/man1'
c9a0594
PYTHONPATH='%{buildroot}%{python3_sitelib}' help2man \
c9a0594
    --no-info --output='%{buildroot}%{_mandir}/man1/helpdev.1' \
c9a0594
    '%{buildroot}%{_bindir}/helpdev'
c9a0594
47fa238
47fa238
%check
47fa238
%pytest -v
4523c68
47fa238
47fa238
%files -n python3-helpdev -f %{pyproject_files}
c5ee337
%{_bindir}/helpdev
c9a0594
%{_mandir}/man1/helpdev.1*
c5ee337
c5ee337
c5ee337
%files doc
c5ee337
%license LICENSE.rst
c5ee337
47fa238
%doc CHANGES.rst
4523c68
%doc README.rst
47fa238
c5ee337
# Text files, mostly sample output
c5ee337
%doc examples/
c5ee337
c5ee337
%if %{with doc_pdf}
c5ee337
%doc build/docs/latex/helpdev.pdf
c5ee337
%endif
47fa238
4523c68
4523c68
%changelog
ad4ad4e
%autochangelog