# Sphinx-generated HTML documentation is not suitable for packaging; see # https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion. # # We can generate PDF documentation as a substitute. %bcond doc_pdf 1 Name: python-helpdev Version: 0.6.10 Release: %autorelease Summary: HelpDev – Extracts information about the Python environment easily # The GitLab archive contains tests and documentation; the PyPI sdist doesn’t. %global forgeurl https://gitlab.com/dpizetta/helpdev %global tag v%{version} %forgemeta License: MIT URL: %{forgeurl} Source: %{forgesource} BuildArch: noarch BuildRequires: python3-devel # Selected test dependencies from req-test.txt; most entries in that file are # for linters, code coverage, etc. Note that we use pytest directly because tox # doesn’t add anything useful for us in this package. BuildRequires: %{py3_dist pytest} # The generated man page is pretty good in this case; it’s probably not worth # hand-writing one. BuildRequires: help2man %if %{with doc_pdf} # We don’t generate documentation dependencies from req-doc.txt because: # - There is extra cruft in there (setuptools, wheel, etc.): no big deal # - We don’t need sphinx_rtd_theme because we aren’t building HTML # - We need to specify the extra BR’s for building LaTeX/PDF manually anyway BuildRequires: make BuildRequires: python3dist(sphinx) BuildRequires: python3-sphinx-latex BuildRequires: latexmk %endif %global common_description %{expand: Helping users and developers to get information about the environment to report bugs or even test your system without spending a day on it. It can get information about hardware, OS, paths, Python distribution and packages, including Qt-things.} %description %{common_description} %package -n python3-helpdev Summary: %{summary} %description -n python3-helpdev %{common_description} %package doc Summary: Documentation and examples for HelpDev %description doc This package includes documentation and examples for HelpDev. %prep %forgesetup # importlib.metadata is in python3.8 # https://gitlab.com/dpizetta/helpdev/merge_requests/1 sed -i "s|'importlib_metadata', ||" setup.py sed -i "s|import importlib_metadata|import importlib.metadata as importlib_metadata|" helpdev/__init__.py %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %if %{with doc_pdf} PYTHONPATH="${PWD}" %make_build -C docs latex \ SPHINXOPTS='-j%{?_smp_build_ncpus}' %make_build -C build/docs/latex LATEXMKOPTS='-quiet' %endif %install %pyproject_install %pyproject_save_files helpdev # Generating the man page in %%install allows us to use the installed entry # point; horrible hacks would be required to do this in %%build. install -d '%{buildroot}%{_mandir}/man1' PYTHONPATH='%{buildroot}%{python3_sitelib}' help2man \ --no-info --output='%{buildroot}%{_mandir}/man1/helpdev.1' \ '%{buildroot}%{_bindir}/helpdev' %check %pytest -v %files -n python3-helpdev -f %{pyproject_files} %{_bindir}/helpdev %{_mandir}/man1/helpdev.1* %files doc %license LICENSE.rst %doc CHANGES.rst %doc README.rst # Text files, mostly sample output %doc examples/ %if %{with doc_pdf} %doc build/docs/latex/helpdev.pdf %endif %changelog %autochangelog