1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-19 19:59:43 +00:00

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 <petr.fischer me com>
MFH:		2017Q3
This commit is contained in:
Kubilay Kocak 2017-07-03 11:22:52 +00:00
parent 8aa6b4dc1c
commit f1a1de7f56
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=444937
3 changed files with 44 additions and 4 deletions

View File

@ -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

View File

@ -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 *

View File

@ -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]