From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAUSp-0000CH-J6 for guix-patches@gnu.org; Tue, 16 May 2017 00:52:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAUSo-0003HG-1n for guix-patches@gnu.org; Tue, 16 May 2017 00:52:03 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:44597) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dAUSn-0003HC-TZ for guix-patches@gnu.org; Tue, 16 May 2017 00:52:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dAUSn-0005sx-OC for guix-patches@gnu.org; Tue, 16 May 2017 00:52:01 -0400 Subject: bug#26924: [PATCH 03/10] gnu: calibre: Import unbundle feedparser patch from Resent-Message-ID: References: From: Brendan Tildesley Message-ID: <059dbdf4-357b-f7ea-a4e0-9c76861a1ded@openmailbox.org> Date: Tue, 16 May 2017 14:51:09 +1000 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------60D4224D63BE8FFEDF526FD1" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 26924@debbugs.gnu.org This is a multi-part message in MIME format. --------------60D4224D63BE8FFEDF526FD1 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit --------------60D4224D63BE8FFEDF526FD1 Content-Type: text/x-patch; name="0003-gnu-calibre-Import-unbundle-feedparser-patch-from-de.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0003-gnu-calibre-Import-unbundle-feedparser-patch-from-de.pa"; filename*1="tch" >From 359c51e1d2669770f1da546f2baebd0fb947bd4d Mon Sep 17 00:00:00 2001 From: Brendan Tildesley Date: Sat, 13 May 2017 22:32:01 +1000 Subject: [PATCH 03/10] gnu: calibre: Import unbundle feedparser patch from debian. * gnu/packages/ebook.scm Use web module for python2-feedparser. (calibre): [source]: Reference new patch file. [inputs]: Add python2-feedparser as an input. * gnu/packages/patches/calibre-use-packaged-feedparser.patch: New file. * gnu/local.mk: Add it. --- gnu/local.mk | 1 + gnu/packages/ebook.scm | 3 ++ .../patches/calibre-use-packaged-feedparser.patch | 51 ++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 gnu/packages/patches/calibre-use-packaged-feedparser.patch diff --git a/gnu/local.mk b/gnu/local.mk index 4c5aabffa..74577c8e5 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -517,6 +517,7 @@ dist_patch_DATA = \ %D%/packages/patches/calibre-drop-unrar.patch \ %D%/packages/patches/calibre-dont-load-remote-icons.patch \ %D%/packages/patches/calibre-no-updates-dialog.patch \ + %D%/packages/patches/calibre-use-packaged-feedparser.patch \ %D%/packages/patches/cdparanoia-fpic.patch \ %D%/packages/patches/cdrtools-3.01-mkisofs-isoinfo.patch \ %D%/packages/patches/ceph-disable-cpu-optimizations.patch \ diff --git a/gnu/packages/ebook.scm b/gnu/packages/ebook.scm index cc43259e2..70ec9ed35 100644 --- a/gnu/packages/ebook.scm +++ b/gnu/packages/ebook.scm @@ -39,6 +39,7 @@ #:use-module (gnu packages python) #:use-module (gnu packages qt) #:use-module (gnu packages tls) + #:use-module (gnu packages web) #:use-module (gnu packages xorg)) (define-public chmlib @@ -80,6 +81,7 @@ (delete-file-recursively "src/unrar") (delete-file "src/odf/thumbnail.py"))) (patches (search-patches "calibre-drop-unrar.patch" + "calibre-use-packaged-feedparser.patch" "calibre-dont-load-remote-icons.patch" "calibre-no-updates-dialog.patch")))) (build-system python-build-system) @@ -116,6 +118,7 @@ ("python2-cssutils" ,python2-cssutils) ("python2-dateutil" ,python2-dateutil) ("python2-dbus" ,python2-dbus) + ("python2-feedparser" ,python2-feedparser) ("python2-lxml" ,python2-lxml) ("python2-mechanize" ,python2-mechanize) ("python2-netifaces" ,python2-netifaces) diff --git a/gnu/packages/patches/calibre-use-packaged-feedparser.patch b/gnu/packages/patches/calibre-use-packaged-feedparser.patch new file mode 100644 index 000000000..8f4bbc824 --- /dev/null +++ b/gnu/packages/patches/calibre-use-packaged-feedparser.patch @@ -0,0 +1,51 @@ +From: Martin Pitt +Date: Mon, 14 Nov 2016 22:41:23 +0100 +Subject: Use packaged instead of bundled feedparser Python module + +--- + recipes/lenta_ru.recipe | 4 +++- + src/calibre/web/feeds/__init__.py | 4 +++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/recipes/lenta_ru.recipe b/recipes/lenta_ru.recipe +index aa4dac4..4b6710c 100644 +--- a/recipes/lenta_ru.recipe ++++ b/recipes/lenta_ru.recipe +@@ -4,11 +4,13 @@ + Lenta.ru + ''' + +-from calibre.web.feeds.feedparser import parse + from calibre.ebooks.BeautifulSoup import Tag + from calibre.web.feeds.news import BasicNewsRecipe ++from feedparser import parse ++from functools import partial + import re + ++parse = partial(parse, agent='Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.11) Gecko/20101012 Firefox/3.6.11') + + class LentaRURecipe(BasicNewsRecipe): + title = u'Lenta.ru: \u041d\u043e\u0432\u043e\u0441\u0442\u0438' +diff --git a/src/calibre/web/feeds/__init__.py b/src/calibre/web/feeds/__init__.py +index 8c9d748..f262604 100644 +--- a/src/calibre/web/feeds/__init__.py ++++ b/src/calibre/web/feeds/__init__.py +@@ -11,7 +11,10 @@ from calibre.utils.logging import default_log + from calibre import entity_to_unicode, strftime, force_unicode + from calibre.utils.date import dt_factory, utcnow, local_tz + from calibre.utils.cleantext import clean_ascii_chars, clean_xml_chars ++from feedparser import parse ++from functools import partial + ++parse = partial(parse, agent='Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.11) Gecko/20101012 Firefox/3.6.11') + + class Article(object): + +@@ -334,7 +337,6 @@ def feed_from_xml(raw_xml, title=None, oldest_article=7, + max_articles_per_feed=100, + get_article_url=lambda item: item.get('link', None), + log=default_log): +- from calibre.web.feeds.feedparser import parse + # Handle unclosed escaped entities. They trip up feedparser and HBR for one + # generates them + raw_xml = re.sub(r'(&#\d+)([^0-9;])', r'\1;\2', raw_xml) -- 2.13.0 --------------60D4224D63BE8FFEDF526FD1--