system/linkchecker: Fix python requests version check.

Thanks to Cristiano Urban for reporting.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Willy Sudiarto Raharjo 2017-01-04 07:20:23 +07:00
parent fca87de0a8
commit 40c0964649
No known key found for this signature in database
GPG key ID: 887B8374D7333381
2 changed files with 51 additions and 2 deletions

View file

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

View file

@ -2,7 +2,7 @@
# Slackware build script for linkchecker
# Copyright 2013-2016 Willy Sudiarto Raharjo <willysr@slackbuilds.org>
# Copyright 2013-2017 Willy Sudiarto Raharjo <willysr@slackbuilds.org>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@ -25,7 +25,7 @@
PRGNAM=linkchecker
SRCNAM=LinkChecker
VERSION=${VERSION:-9.3}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -70,6 +70,10 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Fix python requests version check
# https://github.com/wummel/linkchecker/commit/c2ce810c3fb00b895a841a7be6b2e78c64e7b042
patch -p1 < $CWD/fix-python-requests.patch
python setup.py install --root=$PKG
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \