Skip to content

Commit

Permalink
Merge pull request #19442 from peterhoeg/lc
Browse files Browse the repository at this point in the history
linkchecker: make it work with newer requests2
  • Loading branch information
FRidh committed Oct 12, 2016
2 parents e207ba7 + b120ef4 commit f3c6236
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkgs/tools/networking/linkchecker/default.nix
@@ -1,26 +1,34 @@
{ stdenv, lib, fetchurl, python2Packages }:
{ stdenv, lib, fetchurl, python2Packages, gettext }:

python2Packages.buildPythonApplication rec {
name = "LinkChecker-${version}";
version = "9.3";

# LinkChecker 9.3 only works with requests 2.9.x
propagatedBuildInputs = with python2Packages ; [ requests2 ];
buildInputs = with python2Packages ; [ pytest ];
propagatedBuildInputs = with python2Packages ; [ requests2 ] ++ [ gettext ];

src = fetchurl {
url = "mirror://pypi/L/LinkChecker/${name}.tar.gz";
sha256 = "0v8pavf0bx33xnz1kwflv0r7lxxwj7vg3syxhy2wzza0wh6sc2pf";
};

# upstream refuses to support ignoring robots.txt
# 1. upstream refuses to support ignoring robots.txt
# 2. work around requests2 version detection - can be dropped >v9.3
patches = [
./add-no-robots-flag.patch
./no-version-check.patch
];

postInstall = ''
rm $out/bin/linkchecker-gui
'';

checkPhase = ''
# the mime test fails for me...
rm tests/test_mimeutil.py
make test PYTESTOPTS="--tb=short" TESTS="tests/test_*.py tests/logger/test_*.py"
'';

meta = {
description = "Check websites for broken links";
homepage = "https://wummel.github.io/linkchecker/";
Expand Down
14 changes: 14 additions & 0 deletions pkgs/tools/networking/linkchecker/no-version-check.patch
@@ -0,0 +1,14 @@
diff --git a/linkcheck/__init__.py b/linkcheck/__init__.py
--- a/linkcheck/__init__.py 2014-07-16 13:34:58.000000000 +0800
+++ b/linkcheck/__init__.py 2016-10-11 10:42:08.914085950 +0800
@@ -26,8 +26,8 @@
sys.version_info < (2, 7, 2, 'final', 0)):
raise SystemExit("This program requires Python 2.7.2 or later.")
import requests
-if requests.__version__ <= '2.2.0':
- raise SystemExit("This program requires Python requests 2.2.0 or later.")
+#if requests.__version__ <= '2.2.0':
+# raise SystemExit("This program requires Python requests 2.2.0 or later.")

import os
# add the custom linkcheck_dns directory to sys.path

0 comments on commit f3c6236

Please sign in to comment.