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