From d3a55e472d398c6e25889ae8c361ef463d17b297 Mon Sep 17 00:00:00 2001 From: Henrik Nordstrom Date: Sep 21 2010 12:24:49 +0000 Subject: Backport Python 2.7 fix by Toshio Kuratomi --- diff --git a/bzr.dev-5439-python27.patch b/bzr.dev-5439-python27.patch new file mode 100644 index 0000000..d72fa74 --- /dev/null +++ b/bzr.dev-5439-python27.patch @@ -0,0 +1,55 @@ +diff -up bzr-2.2.1/bzrlib/transport/http/_urllib2_wrappers.py.5439 bzr-2.2.1/bzrlib/transport/http/_urllib2_wrappers.py +--- bzr-2.2.1/bzrlib/transport/http/_urllib2_wrappers.py.5439 2010-09-18 02:37:55.000000000 +0200 ++++ bzr-2.2.1/bzrlib/transport/http/_urllib2_wrappers.py 2010-09-21 14:14:21.000000000 +0200 +@@ -75,6 +75,26 @@ from bzrlib import ( + ) + + ++class addinfourl(urllib2.addinfourl): ++ '''Replacement addinfourl class compatible with python-2.7's xmlrpclib ++ ++ In python-2.7, xmlrpclib expects that the response object that it receives ++ has a getheader method. httplib.HTTPResponse provides this but ++ urllib2.addinfourl does not. Add the necessary functions here, ported to ++ use the internal data structures of addinfourl. ++ ''' ++ ++ def getheader(self, name, default=None): ++ if self.headers is None: ++ raise httplib.ResponseNotReady() ++ return self.headers.getheader(name, default) ++ ++ def getheaders(self): ++ if self.headers is None: ++ raise httplib.ResponseNotReady() ++ return self.headers.items() ++ ++ + class _ReportingFileSocket(object): + + def __init__(self, filesock, report_activity=None): +@@ -656,7 +676,7 @@ class AbstractHTTPHandler(urllib2.Abstra + r = response + r.recv = r.read + fp = socket._fileobject(r, bufsize=65536) +- resp = urllib2.addinfourl(fp, r.msg, req.get_full_url()) ++ resp = addinfourl(fp, r.msg, req.get_full_url()) + resp.code = r.status + resp.msg = r.reason + resp.version = r.version +diff -up bzr-2.2.1/NEWS.5439 bzr-2.2.1/NEWS +--- bzr-2.2.1/NEWS.5439 2010-09-18 02:37:55.000000000 +0200 ++++ bzr-2.2.1/NEWS 2010-09-21 14:16:02.000000000 +0200 +@@ -17,6 +17,12 @@ earlier 2.2 releases. + Compatibility Breaks + ******************** + ++Fedora Backported Bug Fixes ++*************************** ++ ++* Fix traceback with python-2.7's xmlrpclib ++ (Toshio Kuratomi, #612096) ++ + Bug Fixes + ********* + diff --git a/bzr.spec b/bzr.spec index cf575d2..5f00aea 100644 --- a/bzr.spec +++ b/bzr.spec @@ -29,6 +29,8 @@ URL: http://www.bazaar-vcs.org/ Source0: https://launchpad.net/%{name}/%{bzrmajor}/%{version}%{?bzrrc}/+download/%{name}-%{version}%{?bzrrc}.tar.gz Source1: https://launchpad.net/%{name}/%{bzrmajor}/%{version}%{?bzrrc}/+download/%{name}-%{version}%{?bzrrc}.tar.gz.sig Source2: bzr-icon-64.png +#backport of http://bazaar.launchpad.net/%7Ebzr-pqm/bzr/bzr.dev/diff/5439 +Patch1: bzr.dev-5439-python27.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: python-devel zlib-devel @@ -64,6 +66,7 @@ This package contains the documentation for the Bazaar version control system. %prep %setup -q -n %{name}-%{version}%{?bzrrc} +%patch1 -p1 -b.5439 sed -i '1{/#![[:space:]]*\/usr\/bin\/\(python\|env\)/d}' bzrlib/_patiencediff_py.py @@ -138,6 +141,8 @@ rm -rf $RPM_BUILD_ROOT %changelog * Sun Sep 21 2010 Henrik Nordstrom - 2.2.1-1 - Upstream 2.2.1 bugfix release +- Backport bzr.dev rev 5439 change fixing lp: branch references + (Toshio Kuratomi) * Sat Aug 21 2010 Henrik Nordstrom - 2.2.0-1 - Upstream 2.2.0 release