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