about summary refs log tree commit diff
path: root/pkgs/development/python-modules/telfhash/default.nix
blob: 0aafd816d039d5a5e4acd21c0ed85fe3de08acec (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  capstone,
  packaging,
  pyelftools,
  tlsh,
  nose,
}:
buildPythonPackage rec {
  pname = "telfhash";
  version = "0.9.8";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "trendmicro";
    repo = "telfhash";
    rev = "v${version}";
    sha256 = "124zajv43wx9l8rvdvmzcnbh0xpzmbn253pznpbjwvygfx16gq02";
  };

  # The tlsh library's name is just "tlsh"
  postPatch = ''
    substituteInPlace requirements.txt \
       --replace "python-tlsh" "tlsh" \
       --replace "py-tlsh" "tlsh"
  '';

  propagatedBuildInputs = [
    capstone
    pyelftools
    tlsh
    packaging
  ];

  nativeCheckInputs = [ nose ];

  checkPhase = ''
    nosetests
  '';

  pythonImportsCheck = [ "telfhash" ];

  meta = with lib; {
    description = "Symbol hash for ELF files";
    mainProgram = "telfhash";
    homepage = "https://github.com/trendmicro/telfhash";
    license = licenses.asl20;
    maintainers = [ ];
  };
}