[arch-commits] Commit in python-feedparser/repos (3 files)

Eric Bélanger eric at nymeria.archlinux.org
Tue Mar 18 01:04:42 UTC 2014


    Date: Tuesday, March 18, 2014 @ 02:04:42
  Author: eric
Revision: 208108

archrelease: copy trunk to staging-any

Added:
  python-feedparser/repos/staging-any/
  python-feedparser/repos/staging-any/PKGBUILD
    (from rev 208107, python-feedparser/trunk/PKGBUILD)
  python-feedparser/repos/staging-any/fix-chardet-support-in-python-3.patch
    (from rev 208107, python-feedparser/trunk/fix-chardet-support-in-python-3.patch)

---------------------------------------+
 PKGBUILD                              |   65 ++++++++++++++++++++++++++++++++
 fix-chardet-support-in-python-3.patch |   32 +++++++++++++++
 2 files changed, 97 insertions(+)

Copied: python-feedparser/repos/staging-any/PKGBUILD (from rev 208107, python-feedparser/trunk/PKGBUILD)
===================================================================
--- staging-any/PKGBUILD	                        (rev 0)
+++ staging-any/PKGBUILD	2014-03-18 01:04:42 UTC (rev 208108)
@@ -0,0 +1,65 @@
+# $Id$
+# Maintainer: Eric Bélanger <eric at archlinux.org>
+
+pkgbase=python-feedparser
+pkgname=('python2-feedparser' 'python-feedparser' 'python-sgmllib')
+pkgver=5.1.3
+pkgrel=3
+pkgdesc="Parse RSS and Atom feeds in Python"
+arch=('any')
+url="http://code.google.com/p/feedparser/"
+license=('custom')
+makedepends=('python' 'python2' 'libxml2' 'python2-setuptools' 'python-setuptools')
+source=(http://feedparser.googlecode.com/files/feedparser-${pkgver}.tar.bz2
+        fix-chardet-support-in-python-3.patch)
+sha1sums=('dfe654e4babd258b1402b89e889d78330206d78c'
+          '18f6a1290b5d7a256b7bf3d1a41b9a7dd2706cf3')
+
+prepare() {
+  # http://code.google.com/p/feedparser/issues/detail?id=384
+  # https://bugs.archlinux.org/task/33254
+  patch -d "feedparser-$pkgver" -p1 -i \
+    "$srcdir/fix-chardet-support-in-python-3.patch"
+
+  chmod 644  feedparser-${pkgver}/feedparser/feedparser.egg-info/*
+  cp -r feedparser-${pkgver} feedparser-${pkgver}-python2
+  cp -r feedparser-${pkgver} feedparser-${pkgver}-python
+  cp -r feedparser-${pkgver} feedparser-${pkgver}-sgmllib
+
+  (cd feedparser-${pkgver}-python2; sed -i 's#env python$#env python2#' feedparser/feedparser.py)
+  (cd feedparser-${pkgver}-python; 2to3 -w feedparser/feedparser.py feedparser/feedparsertest.py)
+}
+
+build() {
+  cd feedparser-${pkgver}-sgmllib
+  python /usr/lib/python3.4/compileall.py feedparser/sgmllib3.py
+}
+
+package_python2-feedparser() {
+  depends=('python2' 'libxml2' )
+  pkgdesc="Parse RSS and Atom feeds in Python2"
+
+  cd "${srcdir}/feedparser-${pkgver}-python2"
+  python2 setup.py install --root="${pkgdir}"
+  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/license"
+}
+
+package_python-feedparser() {
+  depends=('libxml2' 'python-sgmllib')
+  
+  cd "${srcdir}/feedparser-${pkgver}-python"
+  python setup.py install --root="${pkgdir}"
+  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/license"
+}
+
+package_python-sgmllib() {
+  depends=('python')
+  pkgdesc="Port of sgmllib to python-3"
+  license=('PSF')
+  
+  cd "${srcdir}/feedparser-${pkgver}-sgmllib"
+  install -Dm644 feedparser/sgmllib3.py \
+    "${pkgdir}/usr/lib/python3.4/site-packages/sgmllib.py"
+  install -Dm644 feedparser/__pycache__/sgmllib3.cpython-34.pyc \
+    "${pkgdir}/usr/lib/python3.4/site-packages/__pycache__/sgmllib.cpython-34.pyc"
+}

Copied: python-feedparser/repos/staging-any/fix-chardet-support-in-python-3.patch (from rev 208107, python-feedparser/trunk/fix-chardet-support-in-python-3.patch)
===================================================================
--- staging-any/fix-chardet-support-in-python-3.patch	                        (rev 0)
+++ staging-any/fix-chardet-support-in-python-3.patch	2014-03-18 01:04:42 UTC (rev 208108)
@@ -0,0 +1,32 @@
+From 20a32910f4a521788ba93a8c809cf0db702bed5b Mon Sep 17 00:00:00 2001
+From: Kurt McKee <contactme at kurtmckee.org>
+Date: Mon, 17 Dec 2012 10:41:13 -0600
+Subject: [PATCH] Fix chardet support in Python 3
+
+Fixes issue 384.
+Thanks to Google user Arfrever.TFA for reporting this!
+---
+ NEWS                     | 1 +
+ feedparser/feedparser.py | 6 +++++-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/feedparser/feedparser.py b/feedparser/feedparser.py
+index c78e6a3..e977ae8 100644
+--- a/feedparser/feedparser.py
++++ b/feedparser/feedparser.py
+@@ -3766,7 +3766,11 @@ def convert_to_utf8(http_headers, data):
+     chardet_encoding = None
+     tried_encodings = []
+     if chardet:
+-        chardet_encoding = unicode(chardet.detect(data)['encoding'] or '', 'ascii', 'ignore')
++        chardet_encoding = chardet.detect(data)['encoding']
++        if not chardet_encoding:
++            chardet_encoding = ''
++        if not isinstance(chardet_encoding, unicode):
++            chardet_encoding = unicode(chardet_encoding, 'ascii', 'ignore')
+     # try: HTTP encoding, declared XML encoding, encoding sniffed from BOM
+     for proposed_encoding in (rfc3023_encoding, xml_encoding, bom_encoding,
+                               chardet_encoding, u'utf-8', u'windows-1252', u'iso-8859-2'):
+-- 
+1.8.0.3
+




More information about the arch-commits mailing list