about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pylddwrap/default.nix
blob: dc0ca98f186c28a2e174b82a0a38b3d3e9429305 (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
55
56
57
58
59
60
61
62
63
64
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, icontract
, pytestCheckHook
, pythonOlder
, substituteAll
, typing-extensions
}:

buildPythonPackage rec {
  pname = "pylddwrap";
  version = "1.2.2";
  format = "setuptools";
  disabled = pythonOlder "3.6";

  src = fetchFromGitHub {
    owner = "Parquery";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-Gm82VRu8GP52BohQzpMUJfh6q2tiUA2GJWOcG7ymGgg=";
  };

  patches = [
    (substituteAll {
      src = ./replace_env_with_placeholder.patch;
      ldd_bin = "${stdenv.cc.bintools.libc_bin}/bin/ldd";
    })
  ];

  # Upstream adds some plain text files direct to the package's root directory
  # https://github.com/Parquery/pylddwrap/blob/master/setup.py#L71
  postInstall = ''
    rm -f $out/{LICENSE,README.rst,requirements.txt}
  '';

  propagatedBuildInputs = [
    icontract
    typing-extensions
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  # uses mocked ldd from PATH, but we are patching the source to not look at PATH
  disabledTests = [
    "TestAgainstMockLdd"
    "TestMain"
  ];

  pythonImportsCheck = [ "lddwrap" ];

  meta = with lib; {
    description = "Python wrapper around ldd *nix utility to determine shared libraries of a program";
    mainProgram = "pylddwrap";
    homepage = "https://github.com/Parquery/pylddwrap";
    changelog = "https://github.com/Parquery/pylddwrap/blob/v${version}/CHANGELOG.rst";
    license = licenses.mit;
    maintainers = with maintainers; [ thiagokokada ];
    # should work in any Unix platform that uses glibc, except for darwin
    # since it has its own tool (`otool`)
    badPlatforms = platforms.darwin;
  };
}