Unbundle python-charade/chardet

This commit is contained in:
Ralph Bean 2013-02-27 10:38:40 -05:00
parent 3984dc7586
commit 7fe5b101d0
2 changed files with 51 additions and 13 deletions

View File

@ -0,0 +1,25 @@
From 07c1df1053a61ec5097fe79c68aba7fda7bac3b5 Mon Sep 17 00:00:00 2001
From: Ralph Bean <rbean@redhat.com>
Date: Wed, 27 Feb 2013 10:03:41 -0500
Subject: [PATCH] Use system chardet, not charade.
---
requests/compat.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requests/compat.py b/requests/compat.py
index 5bd4fcb..39421ed 100644
--- a/requests/compat.py
+++ b/requests/compat.py
@@ -4,7 +4,7 @@
pythoncompat
"""
-from .packages import charade as chardet
+import chardet
import sys
--
1.8.1.2

View File

@ -6,18 +6,25 @@
Name: python-requests
Version: 1.1.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: HTTP library, written in Python, for human beings
License: ASL 2.0
URL: http://pypi.python.org/pypi/requests
Source0: http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz
# Explicitly use the system certificates in ca-certificates.
# https://bugzilla.redhat.com/show_bug.cgi?id=904614
Patch0: python-requests-system-cert-bundle.patch
# Unbundle python-charade (a fork of python-chardet).
# https://bugzilla.redhat.com/show_bug.cgi?id=904623
Patch1: python-requests-system-chardet-not-charade.patch
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-chardet
Requires: ca-certificates
Requires: python-chardet
%description
Most existing Python modules for sending HTTP requests are extremely verbose and
@ -29,6 +36,9 @@ designed to make HTTP requests easy for developers.
%package -n python3-requests
Summary: HTTP library, written in Python, for human beings
BuildRequires: python3-devel
BuildRequires: python3-chardet
Requires: python3-chardet
%description -n python3-requests
Most existing Python modules for sending HTTP requests are extremely verbose and
cumbersome. Pythons built-in urllib2 module provides most of the HTTP
@ -41,6 +51,7 @@ designed to make HTTP requests easy for developers.
%setup -q -n requests-%{version}
%patch0 -p1
%patch1 -p1
### TODO: Need to unbundle libraries in the packages directory.
### https://bugzilla.redhat.com/show_bug.cgi?id=904623
@ -50,9 +61,6 @@ designed to make HTTP requests easy for developers.
### https://bugzilla.redhat.com/show_bug.cgi?id=855323
### Review request for urllib3:
### https://bugzilla.redhat.com/show_bug.cgi?id=907688
### chardet/2 is available as python-chardet and python3-chardet so
### those may be easy to unbundle as well (will need patching, but looks
### like a single file, compat.py)
# Unbundle the certificate bundle from mozilla.
rm -rf requests/cacert.pem
@ -62,23 +70,22 @@ rm -rf %{py3dir}
cp -a . %{py3dir}
%endif # with_python3
%build
%if 0%{?_with_python3}
pushd %{py3dir}
rm -rf requests/packages/chardet
# Note -- this means that requests.auth.OAuth1 won't work in py3.
# But, as there isn't an oauthlib for py3, this didn't work anyway.
# Could patch upstream's code to be more explicit about this but
# requests-1.0.x dropped this functionality anyway
rm -rf requests/packages/oauthlib
%{__python3} setup.py build
# Unbundle chardet. Patch1 switches usage to system chardet.
rm -rf build/lib/requests/packages/charade
popd
%endif
rm -rf requests/packages/chardet2
%{__python} setup.py build
# Unbundle chardet. Patch1 switches usage to system chardet.
rm -rf build/lib/requests/packages/charade
%install
rm -rf $RPM_BUILD_ROOT
%if 0%{?_with_python3}
@ -114,6 +121,12 @@ popd
%changelog
* Wed Feb 27 2013 Ralph Bean <rbean@redhat.com> - 1.1.0-2
- Unbundled python-charade/chardet. Using system python-chardet now.
- Removed deprecated comments and actions against oauthlib unbundling.
Those are no longer necessary in 1.1.0.
- Added links to bz tickets over Patch declarations.
* Tue Feb 26 2013 Ralph Bean <rbean@redhat.com> - 1.1.0-1
- Latest upstream.
- Relicense to ASL 2.0 with upstream.