From e3712d3cab570a6ef2ca86d908e47505720d6b16 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 20 Jul 2012 18:24:04 -0700 Subject: [PATCH] New update from upstream - Fixes for previous patches incorporated there - roman.py has been moved into a docutils submodule - docutils doesn't work with PyXML. before I poke around for the bug in PyXML, seeing if we're going to go through with deprecating it or if we can sanitize our python stdlib's handling of it. - Fix for traceback in https://bugzilla.redhat.com/show_bug.cgi?id=786867 --- .gitignore | 1 + docutils-0.9.1-unicode.patch | 30 +++++++++++++++++++ docutils-missing-import.patch | 12 -------- python-docutils.spec | 54 +++++++++++++++-------------------- sources | 2 +- 5 files changed, 55 insertions(+), 44 deletions(-) create mode 100644 docutils-0.9.1-unicode.patch delete mode 100644 docutils-missing-import.patch diff --git a/.gitignore b/.gitignore index f499f21..4e2a5df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ docutils-0.7.tar.gz /docutils-0.8.tar.gz /docutils-0.8.1.tar.gz +/docutils-0.9.1.tar.gz diff --git a/docutils-0.9.1-unicode.patch b/docutils-0.9.1-unicode.patch new file mode 100644 index 0000000..e19ad13 --- /dev/null +++ b/docutils-0.9.1-unicode.patch @@ -0,0 +1,30 @@ +Index: docutils-0.9.1/docutils/parsers/rst/directives/misc.py +=================================================================== +--- docutils-0.9.1.orig/docutils/parsers/rst/directives/misc.py ++++ docutils-0.9.1/docutils/parsers/rst/directives/misc.py +@@ -10,6 +10,7 @@ import sys + import os.path + import re + import time ++import locale + from docutils import io, nodes, statemachine, utils + from docutils.error_reporting import SafeString, ErrorString + from docutils.parsers.rst import Directive, convert_directive_function +@@ -474,6 +475,17 @@ class Date(Directive): + 'a substitution definition.' % self.name) + format = '\n'.join(self.content) or '%Y-%m-%d' + text = time.strftime(format) ++ if sys.version_info< (3, 0): ++ try: ++ text = unicode(text, locale.getpreferredencoding()) ++ except UnicodeError: ++ try: ++ text = unicode(text, 'utf-8') ++ except UnicodeError: ++ # Fallback to something that can decode all bytes to ++ # something. Alternative fallback would be to decode ++ # with errors='replace' ++ text = unicode(text, 'latin-1') + return [nodes.Text(text)] + + diff --git a/docutils-missing-import.patch b/docutils-missing-import.patch deleted file mode 100644 index 0f88742..0000000 --- a/docutils-missing-import.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- docutils/frontend.py.org 2012-01-06 12:49:58.815655161 +0900 -+++ docutils/frontend.py 2012-01-06 13:12:55.783605996 +0900 -@@ -38,7 +38,7 @@ - import docutils - import docutils.utils - import docutils.nodes --from docutils.error_reporting import locale_encoding, ErrorOutput -+from docutils.error_reporting import locale_encoding, ErrorOutput, ErrorString - - - def store_multiple(option, opt, value, parser, *args, **kwargs): - diff --git a/python-docutils.spec b/python-docutils.spec index 7ff7990..87adf1d 100644 --- a/python-docutils.spec +++ b/python-docutils.spec @@ -10,8 +10,8 @@ %global srcname docutils Name: python-%{srcname} -Version: 0.8.1 -Release: 2%{?dist} +Version: 0.9.1 +Release: 1%{?dist} Summary: System for processing plaintext documentation Group: Development/Languages @@ -25,10 +25,7 @@ Source0: http://downloads.sourceforge.net/docutils/%{srcname}-%{version}. # python setup.py sdist # The tarball is in dist/docutils-VERSION.tar.gz #Source0: %{srcname}-%{version}.tar.gz -# Applied upstream. Fixes a traceback when invalid input is given on the cli -Patch0: docutils-missing-import.patch -# Submitted upstream -Patch1: docutils-unicode-traceback.patch +Patch0: docutils-0.9.1-unicode.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -42,6 +39,11 @@ BuildRequires: python-tools Requires: python-imaging Provides: docutils = %{version}-%{release} Obsoletes: docutils < %{version}-%{release} +# Need to resolve this. The python stdlib is importing PyXML code if +# available. But the PyXML code has some bugs and is outdated compared to the +# stdlib. Sent email to try and get a plan to resolve this: +# http://lists.fedoraproject.org/pipermail/devel/2012-July/170075.html +Conflicts: PyXML %description The Docutils project specifies a plaintext markup language, reStructuredText, @@ -77,9 +79,7 @@ This package contains the module, ported to run under python3. %prep %setup -q -n %{srcname}-%{version} - -%patch0 -p0 -b .exc -%patch1 -p1 -b .enc +%patch0 -p1 -b .unic # Remove shebang from library files for file in docutils/_string_template_compat.py docutils/math/{__init__.py,latex2mathml.py}; do @@ -99,16 +99,14 @@ CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build %if 0%{?with_python3} pushd %{py3dir} -# For roman.py -2to3 --write extras CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build # Docutils setup.py does this on build but only to the built copy, not to the # original source. For running the tests afterwards we need to have access to everything -for dir in docutils test tools ; do -rm -rf $dir -cp -pr build/lib/$dir . -done +#for dir in docutils test tools ; do +#rm -rf $dir +#cp -pr build/lib/$dir . +#done popd %endif # with_python3 @@ -126,13 +124,6 @@ pushd %{py3dir} # docutils setup.py runs 2to3 on a copy of the tests and puts it in sitelib. rm -rf %{buildroot}%{python3_sitelib}/test -# docutils only installs this if its not already on the system. Due to the -# possibility that a previous version of docutils may be installed, we install -# it manually here. -file=roman.py -extradest=%{python3_sitelib} -fullextradest=%{buildroot}/$extradest -install -D -m 0644 extras/$file $fullextradest/$file popd rm -rf %{buildroot}%{_bindir}/* @@ -140,14 +131,6 @@ rm -rf %{buildroot}%{_bindir}/* %{__python} setup.py install --skip-build --root %{buildroot} -# docutils only installs this if its not already on the system. Due to the -# possibility that a previous version of docutils may be installed, we install -# it manually here. -file=roman.py -extradest=%{python_sitelib} -fullextradest=%{buildroot}/$extradest -install -D -m 0644 extras/$file $fullextradest/$file - for file in %{buildroot}/%{_bindir}/*.py; do mv $file `dirname $file`/`basename $file .py` done @@ -160,7 +143,7 @@ python test/alltests.py %if 0%{?with_python3} pushd %{py3dir} -python3 test/alltests.py +python3 test3/alltests.py popd %endif @@ -181,6 +164,15 @@ rm -rf %{buildroot} %{python3_sitelib}/* %changelog +* Fri Jul 20 2012 Toshio Kuratomi - 0.9.1-1 +- New update from upstream +- Fixes for previous patches incorporated there +- roman.py has been moved into a docutils submodule +- docutils doesn't work with PyXML. before I poke around for the bug in PyXML, + seeing if we're going to go through with deprecating it or if we can sanitize + our python stdlib's handling of it. +- Fix for traceback in https://bugzilla.redhat.com/show_bug.cgi?id=786867 + * Mon Jan 30 2012 Toshio Kuratomi - 0.8.1-2 - Fix a unicode traceback https://bugzilla.redhat.com/show_bug.cgi?id=785622 diff --git a/sources b/sources index a98104e..67865b3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -2ecf8ba3ece1be1ed666150a80c838c8 docutils-0.8.1.tar.gz +b0d5cd5298fedf9c62f5fd364a274d56 docutils-0.9.1.tar.gz