summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/netmap/default.nix
blob: b9266051d09d99dc274634b574cacf15e1842f10 (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  replaceVars,
  nmap,
  python,
}:

buildPythonPackage rec {
  pname = "netmap";
  version = "0.7.0.2";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "home-assistant-libs";
    repo = "python-nmap";
    rev = version;
    sha256 = "1a44zz9zsxy48ahlpjjrddpyfi7cnfknicfcp35hi588qm430mag";
  };

  patches = [
    (replaceVars ./nmap-path.patch {
      nmap = "${lib.getBin nmap}/bin/nmap";
    })
  ];

  # upstream tests require sudo
  # make sure nmap is found instead
  checkPhase = ''
    runHook preCheck
    ${python.interpreter} -c 'import nmap; nmap.PortScanner()'
    runHook postCheck
  '';

  pythonImportsCheck = [ "nmap" ];

  meta = {
    description = "Python class to use nmap and access scan results from python3";
    homepage = "https://github.com/home-assistant-libs/python-nmap";
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [ dotlambda ];
  };
}