about summary refs log tree commit diff
path: root/pkgs/tools/networking/linkchecker
diff options
context:
space:
mode:
authorPeter Hoeg <peter@speartail.com>2016-10-11 11:02:52 +0800
committerPeter Hoeg <peter@speartail.com>2016-10-11 11:02:52 +0800
commitb120ef422cfc888e93b426084e071c184fd37b3c (patch)
tree7d5f1774f3f446b719d18c1ffd11128ddfe16eee /pkgs/tools/networking/linkchecker
parentadfcc2d9531e78bf6a9e3b56e2f4fc873cb3d87b (diff)
downloadnixlib-b120ef422cfc888e93b426084e071c184fd37b3c.tar
nixlib-b120ef422cfc888e93b426084e071c184fd37b3c.tar.gz
nixlib-b120ef422cfc888e93b426084e071c184fd37b3c.tar.bz2
nixlib-b120ef422cfc888e93b426084e071c184fd37b3c.tar.lz
nixlib-b120ef422cfc888e93b426084e071c184fd37b3c.tar.xz
nixlib-b120ef422cfc888e93b426084e071c184fd37b3c.tar.zst
nixlib-b120ef422cfc888e93b426084e071c184fd37b3c.zip
linkchecker: make it work with newer requests2
linkchecker has an odd version check for requests2 that fails on
versions > 2.9.x.

We patch out the check as we are providing a recent requests2. This
patch should be dropped when linkchecker >v9.3 is released.

We now also run the tests although I had to remove one failing test.
Yes, that's covering up the issue but we're still better off than
before.
Diffstat (limited to 'pkgs/tools/networking/linkchecker')
-rw-r--r--pkgs/tools/networking/linkchecker/default.nix16
-rw-r--r--pkgs/tools/networking/linkchecker/no-version-check.patch14
2 files changed, 26 insertions, 4 deletions
diff --git a/pkgs/tools/networking/linkchecker/default.nix b/pkgs/tools/networking/linkchecker/default.nix
index 79566f129019..59699076a3ac 100644
--- a/pkgs/tools/networking/linkchecker/default.nix
+++ b/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/";
diff --git a/pkgs/tools/networking/linkchecker/no-version-check.patch b/pkgs/tools/networking/linkchecker/no-version-check.patch
new file mode 100644
index 000000000000..49b674f37359
--- /dev/null
+++ b/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