1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 icontract,
7 pytestCheckHook,
8 pythonOlder,
9 replaceVars,
10 setuptools,
11 typing-extensions,
12}:
13
14buildPythonPackage rec {
15 pname = "pylddwrap";
16 version = "1.2.2";
17 pyproject = true;
18 disabled = pythonOlder "3.6";
19
20 src = fetchFromGitHub {
21 owner = "Parquery";
22 repo = "pylddwrap";
23 rev = "v${version}";
24 hash = "sha256-Gm82VRu8GP52BohQzpMUJfh6q2tiUA2GJWOcG7ymGgg=";
25 };
26
27 patches = [
28 (replaceVars ./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 build-system = [ setuptools ];
40
41 propagatedBuildInputs = [
42 icontract
43 typing-extensions
44 ];
45
46 nativeCheckInputs = [ pytestCheckHook ];
47
48 # uses mocked ldd from PATH, but we are patching the source to not look at PATH
49 disabledTests = [
50 "TestAgainstMockLdd"
51 "TestMain"
52 ];
53
54 pythonImportsCheck = [ "lddwrap" ];
55
56 meta = with lib; {
57 description = "Python wrapper around ldd *nix utility to determine shared libraries of a program";
58 mainProgram = "pylddwrap";
59 homepage = "https://github.com/Parquery/pylddwrap";
60 changelog = "https://github.com/Parquery/pylddwrap/blob/v${version}/CHANGELOG.rst";
61 license = licenses.mit;
62 maintainers = with maintainers; [ thiagokokada ];
63 # should work in any Unix platform that uses glibc, except for darwin
64 # since it has its own tool (`otool`)
65 badPlatforms = platforms.darwin;
66 };
67}