#1 Package examples and Sphinx-generated PDF documentation
Merged 2 years ago by mikelo2. Opened 2 years ago by music.
rpms/ music/termcolor pdf-doc  into  rawhide

file modified
+32
@@ -1,3 +1,9 @@ 

+ # 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_without doc_pdf

+ 

  %global debug_package %{nil}

  

  %global common_description %{expand:
@@ -21,6 +27,14 @@ 

  BuildRequires:  gcc-c++

  BuildRequires:  cmake

  

+ %if %{with doc_pdf}

+ BuildRequires:  make

+ BuildRequires:  python3-devel

+ BuildRequires:  python3dist(sphinx)

+ BuildRequires:  python3-sphinx-latex

+ BuildRequires:  latexmk

+ %endif

+ 

  %description %{common_description}

  

  %package devel
@@ -30,6 +44,12 @@ 

  

  %description devel %{common_description}

  

+ %package        doc

+ Summary:        Documentation and examples for %{name}

+ BuildArch:      noarch

+ 

+ %description    doc %{common_description}

+ 

  %prep

  %autosetup -p1

  
@@ -37,6 +57,11 @@ 

  %cmake -DTERMCOLOR_TESTS:BOOL=ON

  %cmake_build

  

+ %if %{with doc_pdf}

+ sphinx-build -b latex docs %{_vpath_builddir}/_latex

+ %make_build -C %{_vpath_builddir}/_latex LATEXMKOPTS='-quiet'

+ %endif

+ 

  %install

  %cmake_install

  
@@ -51,6 +76,13 @@ 

  %{_includedir}/%{name}/

  %{_libdir}/cmake/%{name}/

  

+ %files doc

+ %license LICENSE

+ %doc README.rst

+ %doc examples

+ %if %{with doc_pdf}

+ %doc %{_vpath_builddir}/_latex/termcolor.pdf

+ %endif

  

  %changelog

  %autochangelog

I didn’t bring it up in the package review because it’s totally optional and a bit fussy, but you can definitely package the documentation.

The choice of %{_vpath_builddir}/_latex as a LaTeX output directory is totally arbitrary; it could just as well be foo/bar/bat.

Merge if you like it, close if you don’t!

Thanks for adding the doc!

Pull-Request has been merged by mikelo2

2 years ago
Metadata