1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 icontract,
7 pytestCheckHook,
8 pythonOlder,
9 substituteAll,
10 typing-extensions,
11}:
12
13buildPythonPackage rec {
14 pname = "pylddwrap";
15 version = "1.2.2";
16 format = "setuptools";
17 disabled = pythonOlder "3.6";
18
19 src = fetchFromGitHub {
20 owner = "Parquery";
21 repo = pname;
22 rev = "v${version}";
23 hash = "sha256-Gm82VRu8GP52BohQzpMUJfh6q2tiUA2GJWOcG7ymGgg=";
24 };
25
26 patches = [
27 (substituteAll {
28 src = ./replace_env_with_placeholder.patch;
29 ldd_bin = "${stdenv.cc.bintools.libc_bin}/bin/ldd";
30 })
31 ];
32
33 # Upstream adds some plain text files direct to the package's root directory
34 # https://github.com/Parquery/pylddwrap/blob/master/setup.py#L71
35 postInstall = ''
36 rm -f $out/{LICENSE,README.rst,requirements.txt}
37 '';
38
39 propagatedBuildInputs = [
40 icontract
41 typing-extensions
42 ];
43
44 nativeCheckInputs = [ pytestCheckHook ];
45
46 # uses mocked ldd from PATH, but we are patching the source to not look at PATH
47 disabledTests = [
48 "TestAgainstMockLdd"
49 "TestMain"
50 ];
51
52 pythonImportsCheck = [ "lddwrap" ];
53
54 meta = with lib; {
55 description = "Python wrapper around ldd *nix utility to determine shared libraries of a program";
56 mainProgram = "pylddwrap";
57 homepage = "https://github.com/Parquery/pylddwrap";
58 changelog = "https://github.com/Parquery/pylddwrap/blob/v${version}/CHANGELOG.rst";
59 license = licenses.mit;
60 maintainers = with maintainers; [ thiagokokada ];
61 # should work in any Unix platform that uses glibc, except for darwin
62 # since it has its own tool (`otool`)
63 badPlatforms = platforms.darwin;
64 };
65}