From f1a1de7f56b8bd7c6095fdddba378a10a71e7615 Mon Sep 17 00:00:00 2001 From: Kubilay Kocak Date: Mon, 3 Jul 2017 11:22:52 +0000 Subject: [PATCH] net/py-rainbowstream: Make pocket (really) optional rainbowstream has configurable Pocket support (via settings) but declares the dependency in install_requires, making it a compulsory run-time dependency checked/varified by setuptools. When first committed, given the pocket Python package had not yet been ported, it was (obviously) not included in RUN_DEPENDS, but it was not removed from setup.py:install_requires, resulting in the following runtime error: pkg_resources.DistributionNotFound: The 'pocket' distribution was not found and is required by rainbowstream This could be rectified by the user by installing the package from pip, which is convenient, but which we explicitly recommend against [1]. This commit patches setup.py moving pocket to setup.py:extras_require and the main module to conditionally import pocket, instead of failing as follows: from pocket import Pocket ImportError: No module named pocket While I'm here: - Remove upper bound/limit on 3.x version support [1] See devel/py-pip/pkg-message PR: 220312 Reported by: Petr Fischer MFH: 2017Q3 --- net/py-rainbowstream/Makefile | 5 ++-- .../files/patch-rainbowstream_rainbow.py | 17 ++++++++++++ net/py-rainbowstream/files/patch-setup.py | 26 +++++++++++++++++-- 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 net/py-rainbowstream/files/patch-rainbowstream_rainbow.py diff --git a/net/py-rainbowstream/Makefile b/net/py-rainbowstream/Makefile index 475ff0eeb40b..751ed88b5ed6 100644 --- a/net/py-rainbowstream/Makefile +++ b/net/py-rainbowstream/Makefile @@ -3,6 +3,7 @@ PORTNAME= rainbowstream PORTVERSION= 1.3.5 +PORTREVISION= 1 CATEGORIES= net python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -21,8 +22,8 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}dateutil>0:devel/py-dateutil \ ${PYTHON_PKGNAMEPREFIX}pillow>0:graphics/py-pillow \ ${PYTHON_PKGNAMEPREFIX}pysocks>0:net/py-pysocks -# Actually 2.7,3.2-3.4 -USES= python:2.7-3.4 +# Actually 2.7,3.2- +USES= python:2.7- USE_PYTHON= autoplist concurrent distutils NO_ARCH= yes diff --git a/net/py-rainbowstream/files/patch-rainbowstream_rainbow.py b/net/py-rainbowstream/files/patch-rainbowstream_rainbow.py new file mode 100644 index 000000000000..79eece31c37d --- /dev/null +++ b/net/py-rainbowstream/files/patch-rainbowstream_rainbow.py @@ -0,0 +1,17 @@ +# Make pocket actually optional +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220312 + +--- rainbowstream/rainbow.py.orig 2017-07-03 10:00:26 UTC ++++ rainbowstream/rainbow.py +@@ -20,7 +20,10 @@ from twitter.oauth import OAuth, read_to + from twitter.oauth_dance import oauth_dance + from twitter.util import printNicely + +-from pocket import Pocket ++try: ++ from pocket import Pocket ++except ImportError: ++ pckt = None + + from .draw import * + from .colors import * diff --git a/net/py-rainbowstream/files/patch-setup.py b/net/py-rainbowstream/files/patch-setup.py index cc93c1aac9eb..0e03826afb55 100644 --- a/net/py-rainbowstream/files/patch-setup.py +++ b/net/py-rainbowstream/files/patch-setup.py @@ -1,6 +1,9 @@ ---- setup.py.orig 2016-08-04 08:41:32 UTC +# Make pocket actually optional +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220312 + +--- setup.py.orig 2016-08-16 14:49:45 UTC +++ setup.py -@@ -9,7 +9,7 @@ version = '1.3.3' +@@ -15,14 +15,17 @@ version = '1.3.5' install_requires = [ "python-dateutil", "arrow", @@ -9,3 +12,22 @@ "pyfiglet", "twitter", "Pillow", + "PySocks", +- "pocket" + ] + ++extras_require = { ++ 'pocket': ["pocket"], ++} ++ + # Default user (considers non virtualenv method) + user = os.environ.get('SUDO_USER', os.environ['USER']) + +@@ -65,6 +68,7 @@ setup(name='rainbowstream', + include_package_data=True, + zip_safe=True, + install_requires=install_requires, ++ extras_require=extras_require, + entry_points=""" + # -*- Entry points: -*- + [console_scripts]