openbsd-ports/www/linkchecker/patches/patch-linkcheck___init___py
jca efe35827c6 Fix requests version detection
Reported by MrSatterly, fix from upstream.
2017-07-02 16:18:44 +00:00

33 lines
1.4 KiB
Plaintext

$OpenBSD: patch-linkcheck___init___py,v 1.1 2017/07/02 16:18:44 jca Exp $
commit c2ce810c3fb00b895a841a7be6b2e78c64e7b042
Author: Bastian Kleineidam <bastian.kleineidam@web.de>
Date: Tue Jun 28 21:55:10 2016 +0200
Fix python requests version check
Index: linkcheck/__init__.py
--- linkcheck/__init__.py.orig
+++ linkcheck/__init__.py
@@ -24,10 +24,17 @@ import sys
# 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