summaryrefslogtreecommitdiff
path: root/system/linkchecker/fix-python-requests.patch
diff options
context:
space:
mode:
authorWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-01-04 07:20:23 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-01-04 07:20:23 +0700
commit40c0964649707c8996e4b7556877496b3d2b6337 (patch)
tree414985e821e610e1b230b9799f19910bf65ec62f /system/linkchecker/fix-python-requests.patch
parentfca87de0a808d96e38f202b5c12837fcc6d57737 (diff)
downloadslackbuilds-40c0964649707c8996e4b7556877496b3d2b6337.tar.gz
system/linkchecker: Fix python requests version check.
Thanks to Cristiano Urban for reporting. Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/linkchecker/fix-python-requests.patch')
-rw-r--r--system/linkchecker/fix-python-requests.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/system/linkchecker/fix-python-requests.patch b/system/linkchecker/fix-python-requests.patch
new file mode 100644
index 0000000000..71d6be5c63
--- /dev/null
+++ b/system/linkchecker/fix-python-requests.patch
@@ -0,0 +1,45 @@
+--- LinkChecker-9.3/linkcheck/__init__.py.orig 2014-07-16 12:34:58.000000000 +0700
++++ LinkChecker-9.3/linkcheck/__init__.py 2017-01-04 07:14:54.662953769 +0700
+@@ -24,10 +24,17 @@
+ # Needs Python >= 2.7.2 which fixed http://bugs.python.org/issue11467
+ if not (hasattr(sys, 'version_info') or
+ sys.version_info < (2, 7, 2, 'final', 0)):
+- raise SystemExit("This program requires Python 2.7.2 or later.")
++ import platform
++ version = platform.python_version()
++ raise SystemExit("This program requires Python 2.7.2 or later instead of %s." % version)
++# require a reasonably recent requests module: 2.4.0 from 2014-08-29
+ import requests
+-if requests.__version__ <= '2.2.0':
+- raise SystemExit("This program requires Python requests 2.2.0 or later.")
++# PEP 396 has only version strings, bummer! PEP 386 is also not helpful.
++requests_version = requests.__version__.split('.')
++# Depends on the version scheme of Python requests
++if int(requests_version[0]) < 2 or \
++ (int(requests_version[0]) == 2 and int(requests_version[1]) < 4):
++ raise SystemExit("This program requires Python requests 2.4.0 or later instead of %s." % requests.__version__)
+
+ import os
+ # add the custom linkcheck_dns directory to sys.path
+@@ -45,7 +52,6 @@
+ LOG_CMDLINE,
+ LOG_CHECK,
+ LOG_CACHE,
+- LOG_GUI,
+ LOG_THREAD,
+ LOG_PLUGIN,
+ )
+@@ -65,11 +71,11 @@
+ return configdata.install_data
+
+
+-class LinkCheckerError (StandardError):
++class LinkCheckerError(Exception):
+ """Exception to be raised on linkchecker-specific check errors."""
+ pass
+
+-class LinkCheckerInterrupt (StandardError):
++class LinkCheckerInterrupt(Exception):
+ """Used for testing."""
+ pass
+