From a77e44b2ccd6aea42ec48a1e5f0196375d4bb690 Mon Sep 17 00:00:00 2001 From: Christoph Willing Date: Wed, 26 Jun 2019 17:12:43 +1000 Subject: [PATCH] python/feedparser: Added python3 support Signed-off-by: Christoph Willing --- python/feedparser/001_py37.diff | 23 +++++++++++++++++++++++ python/feedparser/README | 4 +++- python/feedparser/feedparser.SlackBuild | 17 +++++++++++++++-- python/feedparser/feedparser.info | 2 +- 4 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 python/feedparser/001_py37.diff diff --git a/python/feedparser/001_py37.diff b/python/feedparser/001_py37.diff new file mode 100644 index 0000000000..5182a5b2b8 --- /dev/null +++ b/python/feedparser/001_py37.diff @@ -0,0 +1,23 @@ +--- setup.py.orig 2015-07-24 15:00:04.000000000 +1000 ++++ setup.py 2019-06-24 21:34:06.883000000 +1000 +@@ -35,6 +35,9 @@ + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', ++ 'Programming Language :: Python :: 3.5', ++ 'Programming Language :: Python :: 3.6', ++ 'Programming Language :: Python :: 3.7', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Text Processing :: Markup :: XML', + ], +--- feedparser/feedparser.py.orig 2015-07-24 15:00:04.000000000 +1000 ++++ feedparser/feedparser.py 2019-06-24 22:15:09.636000000 +1000 +@@ -130,6 +130,8 @@ + #ACCEPTABLE_URI_SCHEMES = () + + # ---------- required modules (should come with any Python distribution) ---------- ++from __future__ import absolute_import, unicode_literals ++ + import cgi + import codecs + import copy diff --git a/python/feedparser/README b/python/feedparser/README index 1d9eefaa38..dc062ac5d6 100644 --- a/python/feedparser/README +++ b/python/feedparser/README @@ -1 +1,3 @@ -feedparser is a Python utility to parse RSS and Atom feeds. +feedparser is a Python utility library to parse RSS and Atom feeds. + +A python3 version is included if python3 is detected at buildtime. diff --git a/python/feedparser/feedparser.SlackBuild b/python/feedparser/feedparser.SlackBuild index 8f657c6a38..3231c59195 100644 --- a/python/feedparser/feedparser.SlackBuild +++ b/python/feedparser/feedparser.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for feedparser # Modified by Luis Henrique -# Maintained 2014-2016 by Christoph Willing +# Maintained 2014-2019 by Christoph Willing # Copyright 2008-2009 Chess Griffin # All rights reserved. @@ -64,7 +64,7 @@ rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION -tar xf $CWD/$VERSION.tar.gz || tar xf $CWD/$PRGNAM-$VERSION.tar.gz +tar xf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION chown -R root:root . find -L . \ @@ -75,6 +75,19 @@ find -L . \ python setup.py build python setup.py install --root $PKG +if $(python3 -c 'import sys' 2>/dev/null); then + # Python3 doesn't have sgmllib so we provide it here for building + # and later installation as part of the feedparser package. + cp feedparser/sgmllib3.py feedparser/sgmllib.py + PYTHONPATH=$(pwd)/feedparser:$PYTHONPATH + + patch -p0 < $CWD/001_py37.diff + python3 setup.py build + python3 setup.py install --root $PKG + + PYSITEDIR=$(python3 -c "import site; print(site.getsitepackages()[0])") + install -m 0644 feedparser/sgmllib.py $PKG/$PYSITEDIR +fi find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true diff --git a/python/feedparser/feedparser.info b/python/feedparser/feedparser.info index 7ba4b29c89..fe8c8895d9 100644 --- a/python/feedparser/feedparser.info +++ b/python/feedparser/feedparser.info @@ -1,7 +1,7 @@ PRGNAM="feedparser" VERSION="5.2.1" HOMEPAGE="https://github.com/kurtmckee/feedparser" -DOWNLOAD="https://github.com/kurtmckee/feedparser/archive/5.2.1.tar.gz" +DOWNLOAD="https://github.com/kurtmckee/feedparser/archive/5.2.1/feedparser-5.2.1.tar.gz" MD5SUM="885d800496ffd538920960b9dbc45faf" DOWNLOAD_x86_64="" MD5SUM_x86_64=""