summary refs log tree commit diff
path: root/pkgs/tools/networking/linkchecker/default.nix
blob: 480321ad15fcb9ba0db5c70e851d8a84b770d5c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ stdenv, lib, fetchFromGitHub, python3Packages, gettext }:

with python3Packages;

buildPythonApplication rec {
  pname = "linkchecker";
  version = "10.0.0";

  src = fetchFromGitHub {
    owner = pname;
    repo = pname;
    rev = "v" + version;
    sha256 = "sha256-gcaamRxGn124LZ8rU+WzjRookU3akDO0ZyzI7/S6kFA=";
  };

  nativeBuildInputs = [ gettext ];

  propagatedBuildInputs = [
    configargparse
    argcomplete
    beautifulsoup4
    pyopenssl
    dnspython
    pyxdg
    requests
  ];

  checkInputs = [
    parameterized
    pytest
  ];

  postPatch = ''
    sed -i 's/^requests.*$/requests>=2.2/' requirements.txt
    sed -i "s/'request.*'/'requests >= 2.2'/" setup.py
  '';

  # test_timeit2 is flakey, and depends sleep being precise to the milisecond
  checkPhase = ''
    ${lib.optionalString stdenv.isDarwin ''
      # network tests fails on darwin
      rm tests/test_network.py tests/checker/test_http*.py tests/checker/test_content_allows_robots.py tests/checker/test_noproxy.py
    ''}
      pytest --ignore=tests/checker/{test_telnet,telnetserver}.py \
        -k 'not TestLoginUrl and not test_timeit2'
  '';

  meta = {
    description = "Check websites for broken links";
    homepage = "https://linkcheck.github.io/linkchecker/";
    license = lib.licenses.gpl2;
    maintainers = with lib.maintainers; [ peterhoeg tweber ];
  };
}