summaryrefslogtreecommitdiff
path: root/system/linkchecker/fix-python-requests.patch
blob: 71d6be5c63feb1173aa6cb58f4d0f7598057ee74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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