e1020b
%if 0%{?fedora}
e1020b
%global with_python3 1
e1020b
%{!?python3_version: %global python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])")}
e1020b
%else
e1020b
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
e1020b
%endif
e1020b
e1020b
%global upstream_name Sphinx
e1020b
e1020b
Name:       python-sphinx
e1020b
Version:    1.1.3
e1020b
Release:    11%{?dist}
e1020b
Summary:    Python documentation generator
e1020b
e1020b
Group:      Development/Tools
e1020b
e1020b
# Unless otherwise noted, the license for code is BSD
e1020b
# sphinx/util/stemmer.py Public Domain
e1020b
# sphinx/pycode/pgen2 Python
e1020b
# jquery (MIT or GPLv2)
e1020b
License:    BSD and Public Domain and Python and (MIT or GPLv2)
e1020b
URL:        http://sphinx.pocoo.org/
e1020b
Source0:    http://pypi.python.org/packages/source/S/%{upstream_name}/%{upstream_name}-%{version}.tar.gz
e1020b
e1020b
# Sent upstream as a fix to work with the next version of docutils
e1020b
# https://bitbucket.org/birkenfeld/sphinx/issue/998/docutils-010-will-break-sphinx-manpage
e1020b
Patch0: sphinx-docutils-0.10.patch
e1020b
e1020b
# Fixes quoting issue in inheritance_diagram.py
e1020b
# Already applied upstream as part of https://bitbucket.org/birkenfeld/sphinx/commits/fc1db93d21a5a535d9d62e5a0c9f0a806a8c117a
e1020b
Patch1: Sphinx-1.1.3-fix_quoting_in_inheritance.patch
e1020b
e1020b
Patch2: fix-container-directive-handling.patch
e1020b
e1020b
# Enables rebuilding of docs when RHEL is set to FIPS mode.
e1020b
# https://bugzilla.redhat.com/show_bug.cgi?id=966954
e1020b
Patch3: enable-rebuilding-docs-in-FIPS-mode.patch
e1020b
e1020b
# Add missing "meta" and "inline" node visitors for the manpage writer
e1020b
# which fixes some exception errors when building docs.
e1020b
# https://github.com/sphinx-doc/sphinx/commit/0ef7a0a7a36b0c653e535bca77c08027f1a720a8
e1020b
# https://bugzilla.redhat.com/show_bug.cgi?id=1291573
e1020b
Patch4: inline-node-error-fix.patch
e1020b
e1020b
BuildArch:     noarch
e1020b
BuildRequires: python2-devel >= 2.4
e1020b
BuildRequires: python-setuptools
e1020b
BuildRequires: python-docutils
e1020b
BuildRequires: python-jinja2
e1020b
BuildRequires: python-nose
e1020b
# Test dependencies
e1020b
BuildRequires: texlive-latex
e1020b
e1020b
%if 0%{?with_python3}
e1020b
BuildRequires: python3-devel
e1020b
BuildRequires: python3-setuptools
e1020b
BuildRequires: python3-docutils
e1020b
BuildRequires: python3-jinja2
e1020b
BuildRequires: python3-pygments
e1020b
BuildRequires: python3-nose
e1020b
%endif # with_python3
e1020b
e1020b
Requires:      python-docutils
e1020b
Requires:      python-jinja2
e1020b
Requires:      python-pygments
e1020b
e1020b
%description
e1020b
Sphinx is a tool that makes it easy to create intelligent and
e1020b
beautiful documentation for Python projects (or other documents
e1020b
consisting of multiple reStructuredText sources), written by Georg
e1020b
Brandl. It was originally created to translate the new Python
e1020b
documentation, but has now been cleaned up in the hope that it will be
e1020b
useful to many other projects.
e1020b
e1020b
Sphinx uses reStructuredText as its markup language, and many of its
e1020b
strengths come from the power and straightforwardness of
e1020b
reStructuredText and its parsing and translating suite, the Docutils.
e1020b
e1020b
Although it is still under constant development, the following
e1020b
features are already present, work fine and can be seen "in action" in
e1020b
the Python docs:
e1020b
e1020b
    * Output formats: HTML (including Windows HTML Help) and LaTeX,
e1020b
      for printable PDF versions
e1020b
    * Extensive cross-references: semantic markup and automatic links
e1020b
      for functions, classes, glossary terms and similar pieces of
e1020b
      information
e1020b
    * Hierarchical structure: easy definition of a document tree, with
e1020b
      automatic links to siblings, parents and children
e1020b
    * Automatic indices: general index as well as a module index
e1020b
    * Code handling: automatic highlighting using the Pygments highlighter
e1020b
    * Various extensions are available, e.g. for automatic testing of
e1020b
      snippets and inclusion of appropriately formatted docstrings.
e1020b
e1020b
e1020b
%if 0%{?with_python3}
e1020b
%package -n python3-sphinx
e1020b
Summary:    Python documentation generator
e1020b
Group:      Development/Tools
e1020b
Requires:      python3-docutils
e1020b
Requires:      python3-jinja2
e1020b
Requires:      python3-pygments
e1020b
e1020b
%description -n python3-sphinx
e1020b
Sphinx is a tool that makes it easy to create intelligent and
e1020b
beautiful documentation for Python projects (or other documents
e1020b
consisting of multiple reStructuredText sources), written by Georg
e1020b
Brandl. It was originally created to translate the new Python
e1020b
documentation, but has now been cleaned up in the hope that it will be
e1020b
useful to many other projects.
e1020b
e1020b
Sphinx uses reStructuredText as its markup language, and many of its
e1020b
strengths come from the power and straightforwardness of
e1020b
reStructuredText and its parsing and translating suite, the Docutils.
e1020b
e1020b
Although it is still under constant development, the following
e1020b
features are already present, work fine and can be seen "in action" in
e1020b
the Python docs:
e1020b
e1020b
    * Output formats: HTML (including Windows HTML Help) and LaTeX,
e1020b
      for printable PDF versions
e1020b
    * Extensive cross-references: semantic markup and automatic links
e1020b
      for functions, classes, glossary terms and similar pieces of
e1020b
      information
e1020b
    * Hierarchical structure: easy definition of a document tree, with
e1020b
      automatic links to siblings, parents and children
e1020b
    * Automatic indices: general index as well as a module index
e1020b
    * Code handling: automatic highlighting using the Pygments highlighter
e1020b
    * Various extensions are available, e.g. for automatic testing of
e1020b
      snippets and inclusion of appropriately formatted docstrings.
e1020b
%endif # with_python3
e1020b
e1020b
e1020b
%package doc
e1020b
Summary:    Documentation for %{name}
e1020b
Group:      Documentation
e1020b
License:    BSD
e1020b
Requires:   %{name} = %{version}-%{release}
e1020b
e1020b
e1020b
%description doc
e1020b
Sphinx is a tool that makes it easy to create intelligent and
e1020b
beautiful documentation for Python projects (or other documents
e1020b
consisting of multiple reStructuredText sources), written by Georg
e1020b
Brandl. It was originally created to translate the new Python
e1020b
documentation, but has now been cleaned up in the hope that it will be
e1020b
useful to many other projects.
e1020b
e1020b
This package contains documentation in reST and HTML formats.
e1020b
e1020b
e1020b
%prep
e1020b
%setup -q -n %{upstream_name}-%{version}%{?prerel}
e1020b
sed '1d' -i sphinx/pycode/pgen2/token.py
e1020b
e1020b
%patch0 -p1
e1020b
%patch1 -p1
e1020b
%patch2 -p1
e1020b
%patch3 -p1
e1020b
%patch4 -p1
e1020b
e1020b
%if 0%{?with_python3}
e1020b
rm -rf %{py3dir}
e1020b
cp -a . %{py3dir}
e1020b
%endif # with_python3
e1020b
e1020b
e1020b
%build
e1020b
%{__python} setup.py build
e1020b
%if 0%{?with_python3}
e1020b
pushd %{py3dir}
e1020b
%{__python3} setup.py build
e1020b
popd
e1020b
%endif # with_python3
e1020b
e1020b
pushd doc
e1020b
make html
e1020b
make man
e1020b
rm -rf _build/html/.buildinfo
e1020b
mv _build/html ..
e1020b
popd
e1020b
e1020b
e1020b
%install
e1020b
rm -rf %{buildroot}
e1020b
e1020b
# Must do the python3 install first because the scripts in /usr/bin are
e1020b
# overwritten with every setup.py install (and we want the python2 version
e1020b
# to be the default for now).
e1020b
%if 0%{?with_python3}
e1020b
pushd %{py3dir}
e1020b
%{__python3} setup.py install --skip-build --root %{buildroot}
e1020b
for f in %{buildroot}%{_bindir}/sphinx-*;
e1020b
do
e1020b
    mv $f $f-%{python3_version}
e1020b
done
e1020b
popd
e1020b
%endif # with_python3
e1020b
e1020b
%{__python} setup.py install --skip-build --root %{buildroot}
e1020b
e1020b
pushd doc
e1020b
# Deliver man pages
e1020b
install -d %{buildroot}%{_mandir}/man1
e1020b
mv _build/man/sphinx-*.1 %{buildroot}%{_mandir}/man1/
e1020b
%if 0%{?with_python3}
e1020b
for f in %{buildroot}%{_mandir}/man1/sphinx-*.1;
e1020b
do
e1020b
    cp -p $f $(echo $f | sed -e "s|.1$|-%{python3_version}.1|")
e1020b
done
e1020b
%endif # with_python3
e1020b
popd
e1020b
e1020b
# Deliver rst files
e1020b
rm -rf doc/_build
e1020b
sed -i 's|python ../sphinx-build.py|/usr/bin/sphinx-build|' doc/Makefile
e1020b
mv doc reST
e1020b
e1020b
# Move language files to /usr/share;
e1020b
# patch to support this incorporated in 0.6.6
e1020b
pushd %{buildroot}%{python_sitelib}
e1020b
e1020b
for lang in `find sphinx/locale -maxdepth 1 -mindepth 1 -type d -printf "%f "`;
e1020b
do
e1020b
  install -d %{buildroot}%{_datadir}/sphinx/locale/$lang
e1020b
  install -d %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES
e1020b
  mv sphinx/locale/$lang/LC_MESSAGES/sphinx.js \
e1020b
     %{buildroot}%{_datadir}/sphinx/locale/$lang/
e1020b
  mv sphinx/locale/$lang/LC_MESSAGES/sphinx.mo \
e1020b
    %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/
e1020b
  rm -rf sphinx/locale/$lang
e1020b
done
e1020b
popd
e1020b
%find_lang sphinx
e1020b
e1020b
# Language files; Since these are javascript, it's not immediately obvious to
e1020b
# find_lang that they need to be marked with a language.
e1020b
(cd %{buildroot} && find . -name 'sphinx.js') | sed -e 's|^.||' | sed -e \
e1020b
  's:\(.*/locale/\)\([^/_]\+\)\(.*\.js$\):%lang(\2) \1\2\3:' \
e1020b
  >> sphinx.lang
e1020b
e1020b
e1020b
%check
e1020b
make test
e1020b
%if 0%{?with_python3}
e1020b
pushd %{py3dir}
e1020b
make test
e1020b
popd
e1020b
%endif # with_python3
e1020b
e1020b
e1020b
%files -f sphinx.lang
e1020b
%defattr(-,root,root,-)
e1020b
%doc AUTHORS CHANGES EXAMPLES LICENSE README TODO
e1020b
%exclude %{_bindir}/sphinx-*-%{python3_version}
e1020b
%{_bindir}/sphinx-*
e1020b
%{python_sitelib}/*
e1020b
%dir %{_datadir}/sphinx/
e1020b
%dir %{_datadir}/sphinx/locale
e1020b
%dir %{_datadir}/sphinx/locale/*
e1020b
%exclude %{_mandir}/man1/sphinx-*-%{python3_version}.1*
e1020b
%{_mandir}/man1/*
e1020b
e1020b
%if 0%{?with_python3}
e1020b
%files -n python3-sphinx
e1020b
%doc AUTHORS CHANGES EXAMPLES LICENSE README TODO
e1020b
%{_bindir}/sphinx-*-%{python3_version}
e1020b
%{python3_sitelib}/*
e1020b
%dir %{_datadir}/sphinx/
e1020b
%dir %{_datadir}/sphinx/locale
e1020b
%dir %{_datadir}/sphinx/locale/*
e1020b
%{_mandir}/man1/sphinx-*-%{python3_version}.1*
e1020b
%endif # with_python3
e1020b
e1020b
%files doc
e1020b
%defattr(-,root,root,-)
e1020b
%doc html reST
e1020b
e1020b
e1020b
%changelog
e1020b
* Wed Mar 30 2016 Charalampos Stratakis <cstratak@redhat.com> - 1.1.3-11
e1020b
- Added patch to fix inline node exception error when building docs
e1020b
Resolves: rhbz#1291573
e1020b
e1020b
* Thu Mar 10 2016 Tomas Orsava <torsava@redhat.com> - 1.1.3-10
e1020b
- Added patch to enable rebuilding docs in FIPS mode
e1020b
Resolves: rhbz#966954
e1020b
e1020b
* Mon Jun 22 2015 Matej Stuchlik <mstuchli@redhat.com> - 1.1.3-9
e1020b
- Fix "container" directive handling in the text builder
e1020b
Resolves: rhbz#1065137
e1020b
e1020b
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1.1.3-8
e1020b
- Mass rebuild 2013-12-27
e1020b
e1020b
* Sat Mar  9 2013 Michel Salim <salimma@fedoraproject.org> - 1.1.3-7
e1020b
- Fix inheritance_diagram quoting bug, exposed by the newer, stricter dot
e1020b
e1020b
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.3-6
e1020b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
e1020b
e1020b
* Tue Aug 21 2012 Toshio Kuratomi <toshio@fedoraproject.org> - 1.1.3-5
e1020b
- Fix for use of sphinx's manpage writer with docutils-0.10
e1020b
e1020b
* Mon Aug  6 2012 Michel Salim <salimma@fedoraproject.org> - 1.1.3-4
e1020b
- Rebuild for Python 3.3
e1020b
e1020b
* Fri Aug  3 2012 David Malcolm <dmalcolm@redhat.com> - 1.1.3-3
e1020b
- remove rhel logic from with_python3 conditional
e1020b
e1020b
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.3-2
e1020b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
e1020b
e1020b
* Thu Apr  5 2012 Michel Salim <salimma@fedoraproject.org> - 1.1.3-1
e1020b
- Update to 1.1.3
e1020b
e1020b
* Sun Feb  5 2012 Michel Salim <salimma@fedoraproject.org> - 1.1.2-5
e1020b
- Move python3 runtime dependencies to the right subpackage
e1020b
- Properly exclude python3 binaries
e1020b
e1020b
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2-4
e1020b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
e1020b
e1020b
* Sat Dec 17 2011 Michel Salim <salimma@fedoraproject.org> - 1.1.2-3
e1020b
- BR on texlive-latex for LaTeX tests
e1020b
e1020b
* Thu Dec  8 2011 Michel Salim <salimma@fedoraproject.org> - 1.1.2-2
e1020b
- Enable python3 subpackage
e1020b
e1020b
* Mon Nov 28 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 1.1.2-1
e1020b
- Update to upstream 1.1.2
e1020b
e1020b
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.7-2
e1020b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
e1020b
e1020b
* Tue Jan 18 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0.7-1
e1020b
- Update to upstream 1.0.7
e1020b
e1020b
* Mon Jan 17 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0.6-1
e1020b
- Update to upstream 1.0.6
e1020b
e1020b
* Mon Nov  1 2010 Michel Salim <salimma@fedoraproject.org> - 1.0.4-3
e1020b
- Fix -doc Makefile to allow regeneration of .rst files
e1020b
e1020b
* Mon Nov  1 2010 Michel Salim <salimma@fedoraproject.org> - 1.0.4-2
e1020b
- Actually include *.js locale files
e1020b
- Generate manpages
e1020b
e1020b
* Fri Sep 17 2010 Michel Salim <salimma@fedoraproject.org> - 1.0.4-1
e1020b
- Update to 1.0.4
e1020b
- Remove BuildRoot and %%clean declarations
e1020b
e1020b
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 1.0-0.1.b2.1
e1020b
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
e1020b
e1020b
* Mon May 31 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 1.0-0.2.b2
e1020b
- Update to 1.0 beta 2
e1020b
- Fixes problem building html documentation in non-English locales
e1020b
e1020b
* Wed May 26 2010 Michel Salim <salimma@fedoraproject.org> - 1.0-0.1.b1
e1020b
- Update to 1.0 beta 1
e1020b
e1020b
* Tue May 25 2010 Michel Salim <salimma@fedoraproject.org> - 0.6.6-1
e1020b
- Update to 0.6.6
e1020b
e1020b
* Fri May 21 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 0.6.5-2
e1020b
- Few minor tweaks to Gareth's spec file update
e1020b
e1020b
* Mon May 10 2010 Gareth Armstrong <gareth.armstrong@hp.com> - 0.6.5-1.hp
e1020b
- Update to 0.6.5
e1020b
- Initial import of python-sphinx from Fedora Rawhide for use in HP CMS
e1020b
- Enforce that Sphinx requires Python 2.4 or later via an explicit BR
e1020b
- Minor tweaks to spec file
e1020b
- Move language files to %%{_datadir}, idea borrowed from Debian's sphinx
e1020b
  package
e1020b
- Deliver man pages for sphinx-build & sphinx-quickstart
e1020b
- Deliver rst documentation files to reST directory in doc sub-package
e1020b
- Add %%check section for Python2 and add BR on python-nose
e1020b
e1020b
* Wed Jan 13 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 0.6.4-1
e1020b
- Update to 0.6.4
e1020b
- Fixes a problem using autodoc with pylons projects.
e1020b
e1020b
* Fri Sep  4 2009 Michel Salim <salimma@fedoraproject.org> - 0.6.3-1
e1020b
- Update to 0.6.3
e1020b
e1020b
* Mon Aug 17 2009 Toshio Kuratomi <toshio@fedoraproject.org> - 0.6.2-1
e1020b
- Update to 0.6.2 -- upstream bugfix requested inside bz#512438
e1020b
e1020b
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-3
e1020b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
e1020b
e1020b
* Fri Jun 05 2009 Luke Macken <lmacken@redhat.com> - 0.6.1-2
e1020b
- Add a patch to use our own setuptools package
e1020b
e1020b
* Fri Apr 17 2009 Michel Salim <salimma@fedoraproject.org> - 0.6.1-1
e1020b
- Update to 0.6.1
e1020b
e1020b
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-2
e1020b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
e1020b
e1020b
* Fri Jan  2 2009 Michel Salim <salimma@fedoraproject.org> - 0.5.1-1
e1020b
- Update to 0.5.1
e1020b
e1020b
* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.5-2
e1020b
- Rebuild for Python 2.6
e1020b
e1020b
* Mon Nov 24 2008 Michel Salim <salimma@fedoraproject.org> - 0.5-1
e1020b
- Update to 0.5
e1020b
e1020b
* Fri Oct 10 2008 Michel Salim <salimma@fedoraproject.org> - 0.4.3-1
e1020b
- Update to 0.4.3
e1020b
e1020b
* Wed Aug 27 2008 Toshio Kuratomi <toshio@fedoraproject.org> - 0.4.2-1.1
e1020b
- Fix for EL-5 build.
e1020b
e1020b
* Mon Aug 25 2008 Michel Salim <salimma@fedoraproject.org> - 0.4.2-1
e1020b
- Update to 0.4.2
e1020b
e1020b
* Mon May 26 2008 Michel Salim <salimma@fedoraproject.org> - 0.3-1
e1020b
- Update to 0.3
e1020b
e1020b
* Fri May  2 2008 Michel Salim <salimma@fedoraproject.org> - 0.1.61950-3
e1020b
- Split documentation into subpackage
e1020b
- Exclude C files (not built by default anyway)
e1020b
e1020b
* Wed Apr 16 2008 José Matos <jamatos@fc.up.pt> - 0.1.61950-2
e1020b
- Build html documentation, include it and include the rst
e1020b
  documentation.
e1020b
e1020b
* Thu Mar 27 2008 Michel Salim <michel.sylvan@gmail.com> 0.1.61950-1
e1020b
- Initial package