2e94d6
# Just a reminder to remove this when these conditions can no longer occur.
2e94d6
%if 0%{?rhel} && 0%{?rhel} <= 5
2e94d6
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
2e94d6
%endif
2e94d6
2e94d6
%if 0%{?fedora}
2e94d6
%global with_python3 0%{!?_without_python3:1}
2e94d6
%endif
2e94d6
2e94d6
%global srcname docutils
2e94d6
2e94d6
Name:           python-%{srcname}
2e94d6
Version:        0.11
2e94d6
Release:        0.3.20130715svn7687%{?dist}
2e94d6
Summary:        System for processing plaintext documentation
2e94d6
2e94d6
Group:          Development/Languages
2e94d6
# See COPYING.txt for information
2e94d6
License:        Public Domain and BSD and Python and GPLv3+
2e94d6
URL:            http://docutils.sourceforge.net
2e94d6
#Source0:        http://downloads.sourceforge.net/docutils/%{srcname}-%{version}.tar.gz
2e94d6
# Sometimes we need snapshots.  Instructions below:
2e94d6
# svn co -r 7687 svn://svn.code.sf.net/p/docutils/code/trunk/docutils
2e94d6
# cd docutils
2e94d6
# python setup.py sdist
2e94d6
# The tarball is in dist/docutils-VERSION.tar.gz
2e94d6
Source0:        %{srcname}-%{version}.tar.gz
2e94d6
2e94d6
# Fix spurious table column alignment errors.
2e94d6
# Fixed upstream: https://sourceforge.net/p/docutils/code/7898/
2e94d6
Patch1: fix-spurious-table-column-alignment-errors.patch
2e94d6
2e94d6
# Disable some tests known to fail with Python 3.3
2e94d6
# Bug reports filed upstream as:
2e94d6
#   https://sourceforge.net/tracker/?func=detail&aid=3555164&group_id=38414&atid=422030
2e94d6
Patch100: disable-failing-tests.patch
2e94d6
2e94d6
2e94d6
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
2e94d6
BuildArch:       noarch
2e94d6
2e94d6
BuildRequires:  python2-devel
2e94d6
BuildRequires: python-setuptools
2e94d6
%if 0%{?with_python3}
2e94d6
BuildRequires:  python3-devel
2e94d6
BuildRequires:  python-tools
2e94d6
%endif
2e94d6
2e94d6
Requires: python-imaging
2e94d6
Provides: docutils = %{version}-%{release}
2e94d6
Obsoletes: docutils < %{version}-%{release}
2e94d6
2e94d6
%description
2e94d6
The Docutils project specifies a plaintext markup language, reStructuredText,
2e94d6
which is easy to read and quick to write.  The project includes a python
2e94d6
library to parse rST files and transform them into other useful formats such
2e94d6
as HTML, XML, and TeX as well as commandline tools that give the enduser
2e94d6
access to this functionality.
2e94d6
2e94d6
Currently, the library supports parsing rST that is in standalone files and
2e94d6
PEPs (Python Enhancement Proposals).  Work is underway to parse rST from
2e94d6
Python inline documentation modules and packages.
2e94d6
2e94d6
%if 0%{?with_python3}
2e94d6
%package -n python3-%{srcname}
2e94d6
Summary:        System for processing plaintext documentation for python3
2e94d6
Group:          Development/Languages
2e94d6
# This module is optional and not yet available for python3
2e94d6
Requires: python3-imaging
2e94d6
2e94d6
%description -n python3-%{srcname}
2e94d6
The Docutils project specifies a plaintext markup language, reStructuredText,
2e94d6
which is easy to read and quick to write.  The project includes a python
2e94d6
library to parse rST files and transform them into other useful formats such
2e94d6
as HTML, XML, and TeX as well as commandline tools that give the enduser
2e94d6
access to this functionality.
2e94d6
2e94d6
Currently, the library supports parsing rST that is in standalone files and
2e94d6
PEPs (Python Enhancement Proposals).  Work is underway to parse rST from
2e94d6
Python inline documentation modules and packages.
2e94d6
2e94d6
This package contains the module, ported to run under python3.
2e94d6
%endif # with_python3
2e94d6
2e94d6
%prep
2e94d6
%setup -q -n %{srcname}-%{version}
2e94d6
%patch1 -p1
2e94d6
%patch100 -p1 -b .disable-failing-tests
2e94d6
2e94d6
# Remove shebang from library files
2e94d6
for file in docutils/utils/{code_analyzer.py,punctuation_chars.py,error_reporting.py,smartquotes.py} docutils/utils/math/{latex2mathml.py,math2html.py} docutils/writers/xetex/__init__.py; do
2e94d6
sed -i -e '/#! *\/usr\/bin\/.*/{1D}' $file
2e94d6
done
2e94d6
2e94d6
iconv -f ISO88592 -t UTF8 tools/editors/emacs/IDEAS.rst > tmp
2e94d6
mv tmp tools/editors/emacs/IDEAS.rst
2e94d6
2e94d6
%if 0%{?with_python3}
2e94d6
rm -rf %{py3dir}
2e94d6
cp -a . %{py3dir}
2e94d6
%endif
2e94d6
2e94d6
%build
2e94d6
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
2e94d6
2e94d6
%if 0%{?with_python3}
2e94d6
pushd %{py3dir}
2e94d6
2e94d6
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
2e94d6
popd
2e94d6
%endif # with_python3
2e94d6
2e94d6
2e94d6
%install
2e94d6
rm -rf %{buildroot}
2e94d6
2e94d6
# Must do the python3 install first because the scripts in /usr/bin are
2e94d6
# overwritten by setup.py install (and we want the python2 version to be the
2e94d6
# default for now).
2e94d6
%if 0%{?with_python3}
2e94d6
pushd %{py3dir}
2e94d6
%{__python3} setup.py install --skip-build --root %{buildroot}
2e94d6
2e94d6
# docutils setup.py runs 2to3 on a copy of the tests and puts it in sitelib.
2e94d6
rm -rf %{buildroot}%{python3_sitelib}/test
2e94d6
2e94d6
popd
2e94d6
2e94d6
rm -rf %{buildroot}%{_bindir}/*
2e94d6
%endif # with_python3
2e94d6
2e94d6
%{__python} setup.py install --skip-build --root %{buildroot}
2e94d6
2e94d6
for file in %{buildroot}/%{_bindir}/*.py; do
2e94d6
    mv $file `dirname $file`/`basename $file .py`
2e94d6
done
2e94d6
2e94d6
# We want the licenses but don't need this build file
2e94d6
rm -f licenses/docutils.conf
2e94d6
2e94d6
%check
2e94d6
python test/alltests.py
2e94d6
2e94d6
%if 0%{?with_python3}
2e94d6
pushd %{py3dir}
2e94d6
python3 test3/alltests.py
2e94d6
popd
2e94d6
%endif
2e94d6
2e94d6
%clean
2e94d6
rm -rf %{buildroot}
2e94d6
2e94d6
%files
2e94d6
%defattr(-,root,root,-)
2e94d6
%doc BUGS.txt COPYING.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt 
2e94d6
%doc THANKS.txt licenses docs tools/editors
2e94d6
%{_bindir}/*
2e94d6
%{python_sitelib}/*
2e94d6
2e94d6
%if 0%{?with_python3}
2e94d6
%files -n python3-%{srcname}
2e94d6
%defattr(-,root,root,-)
2e94d6
%doc BUGS.txt COPYING.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt 
2e94d6
%doc THANKS.txt licenses docs tools/editors
2e94d6
%{python3_sitelib}/*
2e94d6
%endif
2e94d6
2e94d6
%changelog
2e94d6
* Tue Oct 10 2017 Charalampos Stratakis <cstratak@redhat.com> - 0.11-0.3.20130715svn7687
2e94d6
- Fix spurious table column alignment errors.
2e94d6
Resolves: rhbz#1479804
2e94d6
2e94d6
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 0.11-0.2.20130715svn7687
2e94d6
- Mass rebuild 2013-12-27
2e94d6
2e94d6
* Mon Jul 15 2013 Matej Stuchlik <mstuchli@redhat.com> - 0.11-0.1.20130715svn7687
2e94d6
- Rebased to new snapshot
2e94d6
- Removed unnecessary patches
2e94d6
2e94d6
* Thu Mar 21 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 0.10-0.8.20120824svn7502
2e94d6
- Add python3-imaging support :-)
2e94d6
2e94d6
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10-0.7.20120824svn7502
2e94d6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
2e94d6
2e94d6
* Sat Aug 25 2012 Toshio Kuratomi <toshio@fedoraproject.org> - 0.10-0.6.20120824svn7502
2e94d6
- Further fix of places in the code that use__import__
2e94d6
2e94d6
* Fri Aug 24 2012 Toshio Kuratomi <toshio@fedoraproject.org> - 0.10-0.5.20120824svn7502
2e94d6
- Rebase to new snapshot with some fixes integrated
2e94d6
- Reenable one test that I can't replicate the failure with.
2e94d6
2e94d6
* Fri Aug 24 2012 David Malcolm <dmalcolm@redhat.com> - 0.10-0.4.20120730svn7490
2e94d6
- fix/disable failing tests with python 3.3
2e94d6
2e94d6
* Tue Aug 14 2012 Toshio Kuratomi <toshio@fedoraproject.org> - 0.10-0.3.20120730svn7490
2e94d6
- PyXML patch from upstream
2e94d6
- Fix ability to disable python3 builds
2e94d6
2e94d6
* Fri Aug  3 2012 David Malcolm <dmalcolm@redhat.com> - 0.10-0.2.20120730svn7490
2e94d6
- remove rhel logic from with_python3 conditional
2e94d6
2e94d6
* Mon Jul 30 2012 Toshio Kuratomi <toshio@fedoraproject.org> - 0.10-0.1.20120730svn7490
2e94d6
- Update to snapshot that's supposed to take care of the date directive unicode
2e94d6
  problem in a different way
2e94d6
- Patch to fix PyXML conflict without using rpm conflicts
2e94d6
2e94d6
* Fri Jul 20 2012 Toshio Kuratomi <toshio@fedoraproject.org> - 0.9.1-1
2e94d6
- New update from upstream
2e94d6
- Fixes for previous patches incorporated there
2e94d6
- roman.py has been moved into a docutils submodule
2e94d6
- docutils doesn't work with PyXML.  before I poke around for the bug in PyXML,
2e94d6
  seeing if we're going to go through with deprecating it or if we can sanitize
2e94d6
  our python stdlib's handling of it.
2e94d6
- Fix for traceback in https://bugzilla.redhat.com/show_bug.cgi?id=786867
2e94d6
2e94d6
* Mon Jan 30 2012 Toshio Kuratomi <toshio@fedoraproject.org> - 0.8.1-2
2e94d6
- Fix a unicode traceback https://bugzilla.redhat.com/show_bug.cgi?id=785622
2e94d6
2e94d6
* Thu Jan 5 2012 Toshio Kuratomi <toshio@fedoraproject.org> - 0.8.1-1
2e94d6
- Update to new upstream that has properly licensed files and a few bugfixes
2e94d6
- Add a patch to fix tracebacks when wrong values are given to CLI apps
2e94d6
2e94d6
* Wed Jul 20 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 0.8-2
2e94d6
- Replace the Apache licensed files with BSD licensed versions from upstream
2e94d6
2e94d6
* Tue Jul 12 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 0.8-1
2e94d6
- Upgrade to 0.8 final.
2e94d6
- Remove the two remaining Apache licensed files until their license is fixed.
2e94d6
- Patch regressions that we had already submitted upstream -- resubmit
2e94d6
2e94d6
* Tue May 17 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 0.8-0.1.20110517svn7036
2e94d6
- Ship a snapshot of 0.8 so that we can build on python-3.2.1
2e94d6
- Unfortunately, 3.2.1 isn't out yet either.  So also apply a fix for building
2e94d6
  with 3.2.0 that we'll need to remove later.
2e94d6
- The new docutils.math module is licensed Apache.  Update the license to reflect this
2e94d6
2e94d6
* Wed Mar 16 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 0.7-5
2e94d6
- Fix building with python-3.2 via a workaround.  Sent upstream awaiting
2e94d6
  feedback or a better fix.  Built in rawhide.
2e94d6
2e94d6
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7-4
2e94d6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
2e94d6
2e94d6
* Sat Jan 1 2011 Toshio Kuratomi <toshio@fedoraproject.org> - 0.7-3
2e94d6
- Fix scripts so they're the python2 versions not the python3 versions
2e94d6
2e94d6
* Thu Dec 30 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 0.7-2
2e94d6
- Build for python3
2e94d6
2e94d6
* Sun Aug 1 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 0.7-1
2e94d6
- Update for 0.7 release
2e94d6
2e94d6
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 0.6-2
2e94d6
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
2e94d6
2e94d6
* Tue Jan 19 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 0.6-1
2e94d6
- Update for 0.6 release.
2e94d6
- Switch from setuptools installed egg-info to distutils egg-info.  Note that
2e94d6
  this works because we're also changing docutils version.  To do this between
2e94d6
  0.5-4 and 0.5-5, for instance, we'd need to have %%preun scriptlet to get rid
2e94d6
  of the egg-info directory.
2e94d6
2e94d6
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-4
2e94d6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
2e94d6
2e94d6
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-3
2e94d6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
2e94d6
2e94d6
* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.5-2
2e94d6
- Rebuild for Python 2.6
2e94d6
2e94d6
* Wed Aug 6 2008 Toshio Kuratomi <toshio@fedoraproject.org> 0.5-1
2e94d6
- New upstream version.
2e94d6
2e94d6
* Mon Mar 3 2008 Toshio Kuratomi <toshio@fedoraproject.org> 0.4-8
2e94d6
- Use regular Requires syntax for python-imaging as missingok is just wrong.
2e94d6
2e94d6
* Thu Sep 27 2007 Toshio Kuratomi <a.badger@gmail.com> 0.4-7
2e94d6
- Build egg info.
2e94d6
2e94d6
* Mon Aug 13 2007 Toshio Kuratomi <a.badger@gmail.com> 0.4-6
2e94d6
- Last version had both the old and new rst.el.  Try again with only
2e94d6
  the new one.
2e94d6
2e94d6
* Sun Aug 12 2007 Toshio Kuratomi <a.badger@gmail.com> 0.4-5
2e94d6
- Make License tag conform to the new Licensing Policy.
2e94d6
- Fix the rst emacs mode (RH BZ 250100)
2e94d6
2e94d6
* Sat Dec 09 2006 Toshio Kuratomi <toshio-tiki-lounge.com> 0.4-4
2e94d6
- Bump and rebuild for python 2.5 in devel.
2e94d6
2e94d6
* Tue Aug 29 2006 Toshio Kuratomi <toshio-tiki-lounge.com> 0.4-3
2e94d6
- Bump for FC6 rebuild.
2e94d6
- Remove python byte compilation as this is handled automatically in FC4+.
2e94d6
- No longer %%ghost .pyo files.
2e94d6
  
2e94d6
* Thu Feb 16 2006 Toshio Kuratomi <toshio-tiki-lounge.com> 0.4-2
2e94d6
- Bump and rebuild for FC5.
2e94d6
  
2e94d6
* Sun Jan 15 2006 Toshio Kuratomi <toshio-tiki-lounge.com> 0.4-1
2e94d6
- Update to 0.4.
2e94d6
- Scripted the listing of files in the python module.
2e94d6
- Add a missingok requirement on python-imaging as docutils can make use of
2e94d6
  it when converting to formats that have images.
2e94d6
  
2e94d6
* Tue Jun 7 2005 Toshio Kuratomi <toshio-tiki-lounge.com> 0.3.9-1
2e94d6
- Update to version 0.3.9.
2e94d6
- Use a dist tag as there aren't any differences between supported fc
2e94d6
  releases (FC3, FC4, devel.)
2e94d6
2e94d6
* Thu May 12 2005 Toshio Kuratomi <toshio-tiki-lounge.com> 0.3.7-7
2e94d6
- Bump version and rebuild to sync across architectures.
2e94d6
2e94d6
* Sun Mar 20 2005 Toshio Kuratomi <toshio-tiki-lounge.com> 0.3.7-6
2e94d6
- Rebuild for FC4t1
2e94d6
2e94d6
* Sat Mar 12 2005 Toshio Kuratomi <toshio.tiki-lounge.com> 0.3.7-5
2e94d6
- Add GPL as a license (mschwendt)
2e94d6
- Use versioned Obsoletes and Provides (mschwendt)
2e94d6
2e94d6
* Fri Mar 04 2005 Toshio Kuratomi <toshio.tiki-lounge.com> 0:0.3.7-4
2e94d6
- Rename to python-docutils per the new packaging guidelines.
2e94d6
2e94d6
* Wed Jan 12 2005 Toshio Kuratomi <toshio.tiki-lounge.com> 0:0.3.7-0.fdr.3
2e94d6
- Really install roman.py and build roman.py[co].  Needed to make sure I have
2e94d6
  docutils installed to test that it builds roman.py fine in that case.
2e94d6
2e94d6
* Tue Jan 11 2005 Toshio Kuratomi <toshio.tiki-lounge.com> 0:0.3.7-0.fdr.2
2e94d6
- Special case roman.py to always install.  This is the behaviour we want
2e94d6
  unless something else provides it.  Will need to watch out for this in
2e94d6
  future Core and Extras packages, but the auto detection code makes it
2e94d6
  possible that builds will not be reproducible if roman.py were installed
2e94d6
  from another package.... Lesser of two evils here.
2e94d6
- Provide python-docutils in case that package were preinstalled from
2e94d6
  another repository.
2e94d6
  
2e94d6
* Fri Dec 31 2004 Toshio Kuratomi <toshio.tiki-lounge.com> 0:0.3.7-0.fdr.1
2e94d6
- Update to 0.3.7
2e94d6
- Rename from python-docutils to docutils.
2e94d6
- Make roman.py optionally a part of the files list.  In FC2, this will be
2e94d6
  included.  In FC3, this won't.
2e94d6
- BuildConflict with self since the docutils build detects the presence
2e94d6
  of roman.py and doesn't reinstall itself.
2e94d6
  
2e94d6
* Mon Aug 9 2004 Toshio Kuratomi <toshio.tiki-lounge.com> 0:0.3.5-0.fdr.1
2e94d6
- Update to 0.3.5.
2e94d6
- Update spec style to latest fedora-rpmdevtools.
2e94d6
- Merge everything into a single package.  There isn't very much space
2e94d6
  advantage to having separate packages in a package this small and in
2e94d6
  this case, the documentation on using docutils as a library is also a
2e94d6
  good example of how to write in ReSructuredText.
2e94d6
2e94d6
* Sat Jan 10 2004 Michel Alexandre Salim <salimma[AT]users.sf.net> 0:0.3-0.fdr.1
2e94d6
- Initial RPM release.