about summary refs log tree commit diff
path: root/pkgs/tools/networking/linkchecker
diff options
context:
space:
mode:
authorSteven Shaw <steven@steshaw.org>2019-07-23 18:07:56 +1000
committerSteven Shaw <steven@steshaw.org>2019-07-24 17:42:47 +1000
commita4520359e359c196c4250ccdecc9a0555713e9ab (patch)
tree29af9d42a49f0da03059b6655e645f3170624288 /pkgs/tools/networking/linkchecker
parent356d9ad758b75674108cb0fbe22238acf260816d (diff)
downloadnixlib-a4520359e359c196c4250ccdecc9a0555713e9ab.tar
nixlib-a4520359e359c196c4250ccdecc9a0555713e9ab.tar.gz
nixlib-a4520359e359c196c4250ccdecc9a0555713e9ab.tar.bz2
nixlib-a4520359e359c196c4250ccdecc9a0555713e9ab.tar.lz
nixlib-a4520359e359c196c4250ccdecc9a0555713e9ab.tar.xz
nixlib-a4520359e359c196c4250ccdecc9a0555713e9ab.tar.zst
nixlib-a4520359e359c196c4250ccdecc9a0555713e9ab.zip
linkchecker: 9.3.1 -> 9.4.0
Version 9.3.1 was crashing.
Diffstat (limited to 'pkgs/tools/networking/linkchecker')
-rw-r--r--pkgs/tools/networking/linkchecker/add-no-robots-flag.patch60
-rw-r--r--pkgs/tools/networking/linkchecker/default.nix77
2 files changed, 31 insertions, 106 deletions
diff --git a/pkgs/tools/networking/linkchecker/add-no-robots-flag.patch b/pkgs/tools/networking/linkchecker/add-no-robots-flag.patch
deleted file mode 100644
index 270ef2c02e1e..000000000000
--- a/pkgs/tools/networking/linkchecker/add-no-robots-flag.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-diff --git a/linkcheck/checker/httpurl.py b/linkcheck/checker/httpurl.py
-index 6f207b6..161619c 100644
---- a/linkcheck/checker/httpurl.py
-+++ b/linkcheck/checker/httpurl.py
-@@ -75,7 +75,7 @@ def allows_robots (self, url):
-         @return: True if access is granted, otherwise False
-         @rtype: bool
-         """
--        return self.aggregate.robots_txt.allows_url(self)
-+        return not self.aggregate.config['robotstxt'] or self.aggregate.robots_txt.allows_url(self)
- 
-     def content_allows_robots (self):
-         """
-diff --git a/linkcheck/configuration/__init__.py b/linkcheck/configuration/__init__.py
-index fc2c148..234fa05 100644
---- a/linkcheck/configuration/__init__.py
-+++ b/linkcheck/configuration/__init__.py
-@@ -163,6 +163,7 @@ def __init__ (self):
-         ## checking options
-         self["allowedschemes"] = []
-         self['cookiefile'] = None
-+        self['robotstxt'] = True
-         self["debugmemory"] = False
-         self["localwebroot"] = None
-         self["maxfilesizeparse"] = 1*1024*1024
-diff --git a/linkcheck/configuration/confparse.py b/linkcheck/configuration/confparse.py
-index 67751ed..845fa95 100644
---- a/linkcheck/configuration/confparse.py
-+++ b/linkcheck/configuration/confparse.py
-@@ -149,6 +149,7 @@ def read_checking_config (self):
-                  self.get(section, 'allowedschemes').split(',')]
-         self.read_boolean_option(section, "debugmemory")
-         self.read_string_option(section, "cookiefile")
-+        self.read_boolean_option(section, "robotstxt")
-         self.read_string_option(section, "localwebroot")
-         try:
-             self.read_boolean_option(section, "sslverify")
-diff --git a/linkchecker b/linkchecker
-index 199532c..9e91fa5 100755
---- a/linkchecker
-+++ b/linkchecker
-@@ -321,6 +321,9 @@ group.add_argument("--cookiefile", dest="cookiefile", metavar="FILENAME",
-                  help=_(
- """Read a file with initial cookie data. The cookie data format is
- explained below."""))
-+# const because store_false doesn't detect absent flags
-+group.add_argument("--no-robots", action="store_const", const=False,
-+                   dest="norobotstxt", help=_("Disable robots.txt checks"))
- group.add_argument("--check-extern", action="store_true",
-                  dest="checkextern", help=_("""Check external URLs."""))
- group.add_argument("--ignore-url", action="append", metavar="REGEX",
-@@ -431,6 +434,8 @@ if options.externstrict:
- if options.extern:
-     pats = [linkcheck.get_link_pat(arg) for arg in options.extern]
-     config["externlinks"].extend(pats)
-+if options.norobotstxt is not None:
-+    config['robotstxt'] = options.norobotstxt
- if options.checkextern:
-     config["checkextern"] = True
- elif not config["checkextern"]:
diff --git a/pkgs/tools/networking/linkchecker/default.nix b/pkgs/tools/networking/linkchecker/default.nix
index acc6893d0cd5..3c361fe48baf 100644
--- a/pkgs/tools/networking/linkchecker/default.nix
+++ b/pkgs/tools/networking/linkchecker/default.nix
@@ -1,64 +1,49 @@
-{ stdenv, lib, fetchFromGitHub, fetchpatch, python2, gettext }:
-let
-  # pin requests version until next release.
-  # see: https://github.com/linkcheck/linkchecker/issues/76
-  python2Packages = (python2.override {
-    packageOverrides = self: super: {   
-      requests = super.requests.overridePythonAttrs(oldAttrs: rec {
-        version = "2.14.2";
-        src = oldAttrs.src.override {
-          inherit version;
-          sha256 = "0lyi82a0ijs1m7k9w1mqwbmq1qjsac35fazx7xqyh8ws76xanx52";
-        };
-      });
-    };
-  }).pkgs;
-in
-python2Packages.buildPythonApplication rec {
-  pname = "LinkChecker";
-  version = "9.3.1";
-
-  nativeBuildInputs = [ gettext ];
-  pythonPath = (with python2Packages; [
-    requests
-  ]) ++ [ gettext ];
+{ stdenv, lib, fetchFromGitHub, python2Packages, gettext }:
 
-  checkInputs = with python2Packages; [ pytest ];
+python2Packages.buildPythonApplication rec {
+  pname = "linkchecker";
+  version = "9.4.0";
 
-  # the original repository is abandoned, development is now happening here:
   src = fetchFromGitHub {
-    owner = "linkcheck";
-    repo = "linkchecker";
+    owner = pname;
+    repo = pname;
     rev = "v${version}";
-    sha256 = "080mv4iwvlsfnm7l9basd6i8p4q8990mdhkwick9s6javrbf1r1d";
+    sha256 = "1vbwl2vb8dyzki27z3sl5yf9dhdd2cpkg10vbgaz868dhpqlshgs";
   };
 
-  # 1. upstream refuses to support ignoring robots.txt
-  # 2. fix build: https://github.com/linkcheck/linkchecker/issues/10
-  patches = 
-    let
-      fix-setup-py = fetchpatch {
-        name = "fix-setup-py.patch";
-        url = https://github.com/linkcheck/linkchecker/commit/e62e630.patch;
-        sha256 = "046q1whg715w2yv33xx6rkj7fspvvz60cl978ax92lnf8j101czx";
-      };
-    in [
-      ./add-no-robots-flag.patch
-      fix-setup-py
-    ];
+  nativeBuildInputs = [ gettext ];
 
-  postInstall = ''
-    rm $out/bin/linkchecker-gui
+  propagatedBuildInputs = with python2Packages; [
+    ConfigArgParse
+    argcomplete
+    dnspython
+    pyxdg
+    requests
+  ];
+
+  checkInputs = with python2Packages; [
+    parameterized
+    pytest
+  ];
+
+  postPatch = ''
+    sed -i 's/^requests.*$/requests>=2.2/' requirements.txt
+    sed -i "s/'request.*'/'requests >= 2.2'/" setup.py
+    sed -i 's~/usr/lib/python2.7/argparse.py~~g' po/Makefile
   '';
 
   checkPhase = ''
+    runHook preCheck
+
     # the mime test fails for me...
     rm tests/test_mimeutil.py
     ${lib.optionalString stdenv.isDarwin ''
-    # network tests fails on darwin
-    rm tests/test_network.py
+      # network tests fails on darwin
+      rm tests/test_network.py
     ''}
     make test PYTESTOPTS="--tb=short" TESTS="tests/test_*.py tests/logger/test_*.py"
+
+    runHook postCheck
   '';
 
   meta = {