python-feedparser prepared python3 version

This commit is contained in:
AlmAck 2015-02-01 22:52:30 +01:00
parent 1e6cf1fd5e
commit 18cb15610d
3 changed files with 85 additions and 34 deletions

View File

@ -0,0 +1,53 @@
#
# Apps Packages for Chakra, part of chakra-project.org
#
# Maintainer: Adrian Chaves Fernandez (Gallaecio) <adriyetichaves@gmail.com>
_pkgname=feedparser
pkgbase=python-feedparser
pkgname=('python2-feedparser' 'python3-feedparser')
pkgver=5.1.3
pkgrel=2
pkgdesc="feedparser is a Python library that parses feeds in all known formats, including Atom, RSS, and RDF."
arch=('any')
url="http://code.google.com/p/feedparser/"
license=('MIT')
depends=('python2' 'libxml2')
makedepends=('python2-setuptools' 'python3-setuptools')
replaces=('python-feedparser')
provides=('python-feedparser')
source=("http://${_pkgname}.googlecode.com/files/${_pkgname}-${pkgver}.tar.bz2"
fix-chardet-support-in-python-3.patch)
md5sums=('6fb6372a1dc2f56d4d79d740b8f49f25'
'8d169c4abcccfcde1681f845a9c6cbd4')
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}-python3
(cd feedparser-${pkgver}-python2; sed -i 's#env python$#env python2#' feedparser/feedparser.py)
(cd feedparser-${pkgver}-python3; 2to3 -w feedparser/feedparser.py feedparser/feedparsertest.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_python3-feedparser() {
depends=('libxml2' 'python-sgmllib')
cd "${srcdir}/feedparser-${pkgver}-python3"
python3 setup.py install --root="${pkgdir}"
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/license"
}

View File

@ -0,0 +1,32 @@
From 20a32910f4a521788ba93a8c809cf0db702bed5b Mon Sep 17 00:00:00 2001
From: Kurt McKee <contactme@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

View File

@ -1,34 +0,0 @@
#
# Apps Packages for Chakra, part of chakra-project.org
#
# Maintainer: Adrian Chaves Fernandez (Gallaecio) <adriyetichaves@gmail.com>
_pkgname=feedparser
pkgname="python2-${_pkgname}"
pkgver=5.1.3
pkgrel=1
pkgdesc="feedparser is a Python library that parses feeds in all known formats, including Atom, RSS, and RDF."
arch=('any')
url="http://code.google.com/p/feedparser/"
license=('MIT')
depends=('python2' 'libxml2')
makedepends=('python-distribute')
replaces=('python-feedparser')
provides=('python-feedparser')
source=("http://${_pkgname}.googlecode.com/files/${_pkgname}-${pkgver}.tar.bz2")
md5sums=('6fb6372a1dc2f56d4d79d740b8f49f25')
build() {
cd "${srcdir}/${_pkgname}-${pkgver}"
# Fix permissions, or some files will be unreadable by the common users
chmod 644 feedparser/feedparser.egg-info/*
python2 setup.py build
}
package() {
cd "${srcdir}/${_pkgname}-${pkgver}"
python2 setup.py install --root="${pkgdir}"
install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}