From 93752a8eebfe6811decdaa298158140d927bcdde Mon Sep 17 00:00:00 2001 From: Thorsten Weber Date: Mon, 5 Mar 2018 16:14:21 +0100 Subject: [PATCH] linkchecker: 9.3 -> 9.3.1 This also uses an older requests version because linkchecker breaks with requests > 2.14.2. --- pkgs/tools/networking/linkchecker/default.nix | 59 ++++++++++++++----- .../linkchecker/no-version-check.patch | 14 ----- 2 files changed, 43 insertions(+), 30 deletions(-) delete mode 100644 pkgs/tools/networking/linkchecker/no-version-check.patch diff --git a/pkgs/tools/networking/linkchecker/default.nix b/pkgs/tools/networking/linkchecker/default.nix index 686242aa0670d2..6e41de8999b9c0 100644 --- a/pkgs/tools/networking/linkchecker/default.nix +++ b/pkgs/tools/networking/linkchecker/default.nix @@ -1,23 +1,50 @@ -{ stdenv, lib, fetchurl, python2Packages, gettext }: - +{ 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 { - name = "LinkChecker-${version}"; - version = "9.3"; + pname = "LinkChecker"; + version = "9.3.1"; + + propagatedBuildInputs = (with python2Packages; [ + requests + ]) ++ [ gettext ]; - buildInputs = with python2Packages ; [ pytest ]; - propagatedBuildInputs = with python2Packages ; [ requests ] ++ [ gettext ]; + checkInputs = with python2Packages; [ pytest ]; - src = fetchurl { - url = "mirror://pypi/L/LinkChecker/${name}.tar.gz"; - sha256 = "0v8pavf0bx33xnz1kwflv0r7lxxwj7vg3syxhy2wzza0wh6sc2pf"; + # the original repository is abandoned, development is now happening here: + src = fetchFromGitHub { + owner = "linkcheck"; + repo = "linkchecker"; + rev = "v${version}"; + sha256 = "080mv4iwvlsfnm7l9basd6i8p4q8990mdhkwick9s6javrbf1r1d"; }; # 1. upstream refuses to support ignoring robots.txt - # 2. work around requests version detection - can be dropped >v9.3 - patches = [ - ./add-no-robots-flag.patch - ./no-version-check.patch - ]; + # 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 + ]; postInstall = '' rm $out/bin/linkchecker-gui @@ -35,8 +62,8 @@ python2Packages.buildPythonApplication rec { meta = { description = "Check websites for broken links"; - homepage = https://wummel.github.io/linkchecker/; + homepage = https://linkcheck.github.io/linkchecker/; license = lib.licenses.gpl2; - maintainers = with lib.maintainers; [ peterhoeg ]; + maintainers = with lib.maintainers; [ peterhoeg tweber ]; }; } diff --git a/pkgs/tools/networking/linkchecker/no-version-check.patch b/pkgs/tools/networking/linkchecker/no-version-check.patch deleted file mode 100644 index 49b674f373596a..00000000000000 --- a/pkgs/tools/networking/linkchecker/no-version-check.patch +++ /dev/null @@ -1,14 +0,0 @@ -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