From 8cb9a4d2a79a232e511bc50b55a746ceed55109e Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Tue, 17 May 2011 12:02:08 -0700 Subject: [PATCH] Fix building with python-3.2 via a workaround. Sent upstream awaiting feedback or a better fix. Built in rawhide. --- .gitignore | 1 + docutils-py3.2-configparser.patch | 49 ------------------------------- python-docutils.spec | 44 +++++++++++++++++---------- sources | 2 +- 4 files changed, 30 insertions(+), 66 deletions(-) delete mode 100644 docutils-py3.2-configparser.patch diff --git a/.gitignore b/.gitignore index ee57b18..0024d98 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ docutils-0.7.tar.gz +/docutils-0.8.tar.gz diff --git a/docutils-py3.2-configparser.patch b/docutils-py3.2-configparser.patch deleted file mode 100644 index 418153f..0000000 --- a/docutils-py3.2-configparser.patch +++ /dev/null @@ -1,49 +0,0 @@ -Index: docutils-0.7/docutils/frontend.py -=================================================================== ---- docutils-0.7.orig/docutils/frontend.py -+++ docutils-0.7/docutils/frontend.py -@@ -671,7 +671,7 @@ class OptionParser(optparse.OptionParser - raise KeyError('No option with dest == %r.' % dest) - - --class ConfigParser(CP.ConfigParser): -+class ConfigParser(CP.RawConfigParser): - - old_settings = { - 'pep_stylesheet': ('pep_html writer', 'stylesheet'), -@@ -693,7 +693,7 @@ Skipping "%s" configuration file. - """ - - def __init__(self, *args, **kwargs): -- CP.ConfigParser.__init__(self, *args, **kwargs) -+ CP.RawConfigParser.__init__(self, *args, **kwargs) - - self._files = [] - """List of paths of configuration files read.""" -@@ -708,7 +708,7 @@ Skipping "%s" configuration file. - except IOError: - continue - try: -- CP.ConfigParser.readfp(self, fp, filename) -+ CP.RawConfigParser.readfp(self, fp, filename) - except UnicodeDecodeError: - sys.stderr.write(self.not_utf8_error % (filename, filename)) - fp.close() -@@ -749,7 +749,7 @@ Skipping "%s" configuration file. - except KeyError: - continue - if option.validator: -- value = self.get(section, setting, raw=1) -+ value = self.get(section, setting) - try: - new_value = option.validator( - setting, value, option_parser, -@@ -778,7 +778,7 @@ Skipping "%s" configuration file. - section_dict = {} - if self.has_section(section): - for option in self.options(section): -- section_dict[option] = self.get(section, option, raw=1) -+ section_dict[option] = self.get(section, option) - return section_dict - - diff --git a/python-docutils.spec b/python-docutils.spec index 28f13a5..0cc750e 100644 --- a/python-docutils.spec +++ b/python-docutils.spec @@ -1,28 +1,30 @@ # Just a reminder to remove this when these conditions can no longer occur. -%if 0%{?fedora} <= 12 && 0%{?rhel} <= 5 +%if 0%{?rhel} && 0%{?rhel} <= 5 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %endif -%if 0%{?fedora} > 12 || 0%{?rhel} > 6 +%if 0%{?fedora} || 0%{?rhel} > 6 %global with_python3 1 %endif %global srcname docutils Name: python-%{srcname} -Version: 0.7 -Release: 4%{?dist} +Version: 0.8 +Release: 0.1.20110517svn7036%{?dist} Summary: System for processing plaintext documentation Group: Development/Languages # See COPYING.txt for information License: Public Domain and MIT and Python and GPLv2 URL: http://docutils.sourceforge.net -Source0: http://downloads.sourceforge.net/docutils/%{srcname}-%{version}.tar.gz -# ConfigParser on python-3.2 has changed behaviour -# Sent upstream here: -# https://sourceforge.net/tracker/?func=detail&aid=3149845&group_id=38414&atid=422030 -Patch0: docutils-py3.2-configparser.patch +#Source0: http://downloads.sourceforge.net/docutils/%{srcname}-%{version}.tar.gz +# Build a snapshot +# svn co svn://svn.berlios.de/docutils/trunk/docutils +# cd docutils +# python setup.py sdist +# The tarball is in dist/docutils-VERSION.tar.gz +Source0: %{srcname}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -71,20 +73,25 @@ This package contains the module, ported to run under python3. %prep %setup -q -n %{srcname}-%{version} -%patch0 -p1 -b .cfgparse + +# We want to check if this is necessary every time we rebuild +# since it is icky, nasty, and gross. +# The python3 bug that needs to be solved for this to work is: +# https://bugzilla.redhat.com/show_bug.cgi?id=705436 +%if 0%{?with_python3} +if test x"%{release}" = x"0.1.20110517svn7036%{?dist}" ; then + sed -i 's/Günter/Gunter/' tools/rst2xetex.py +fi +%endif # Remove shebang from library files -for file in docutils/_string_template_compat.py docutils/readers/python/pynodes.py ; do +for file in docutils/_string_template_compat.py ; do sed -i -e '/#! *\/usr\/bin\/.*/{1D}' $file done + %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} -# This module depends on a python2-only module. It has been removed upstream -# for the pending docutils-0.8 release -rm -rf %{py3dir}/docutils/readers/python/ -rm -rf %{py3dir}/docutils/test/test_readers/test_python/ -sed -i "/docutils.readers.python/d" %{py3dir}/setup.py %endif %build @@ -174,6 +181,11 @@ rm -rf %{buildroot} %{python3_sitelib}/* %changelog +* Tue May 17 2011 Toshio Kuratomi - 0.8-0.1.20110517svn7036 +- Ship a snapshot of 0.8 so that we can build on python-3.2.1 +- Unfortunately, 3.2.1 isn't out yet either. So also apply a fix for building + with 3.2.0 that we'll need to remove later. + * Wed Mar 16 2011 Toshio Kuratomi - 0.7-5 - Fix building with python-3.2 via a workaround. Sent upstream awaiting feedback or a better fix. Built in rawhide. diff --git a/sources b/sources index b7edec4..dad96d1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -9aec716baf15d06b5aa57cf8d5591c15 docutils-0.7.tar.gz +b31ddafaf1c091fca4661270cf20c1b0 docutils-0.8.tar.gz