python3Packages.pylddwrap: patch to use ldd from stdenv.cc.bintools.libc_bin
This commit is contained in:
parent
864814228e
commit
1543c5f4f4
|
@ -1,10 +1,11 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, buildPythonPackage
|
||||
, coreutils
|
||||
, fetchFromGitHub
|
||||
, icontract
|
||||
, pytestCheckHook
|
||||
, pythonOlder
|
||||
, substituteAll
|
||||
, typing-extensions
|
||||
}:
|
||||
|
||||
|
@ -21,10 +22,12 @@ buildPythonPackage rec {
|
|||
hash = "sha256-Gm82VRu8GP52BohQzpMUJfh6q2tiUA2GJWOcG7ymGgg=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace lddwrap/__init__.py \
|
||||
--replace '/usr/bin/env' '${coreutils}/bin/env'
|
||||
'';
|
||||
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
|
||||
|
@ -39,6 +42,12 @@ buildPythonPackage rec {
|
|||
|
||||
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; {
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
diff --git a/lddwrap/__init__.py b/lddwrap/__init__.py
|
||||
index 1222c97..db8a735 100644
|
||||
--- a/lddwrap/__init__.py
|
||||
+++ b/lddwrap/__init__.py
|
||||
@@ -190,10 +190,8 @@ def list_dependencies(path: pathlib.Path,
|
||||
Otherwise specified env is used.
|
||||
:return: list of dependencies
|
||||
"""
|
||||
- # We need to use /usr/bin/env since Popen ignores the PATH,
|
||||
- # see https://stackoverflow.com/questions/5658622
|
||||
proc = subprocess.Popen(
|
||||
- ["/usr/bin/env", "ldd", path.as_posix()],
|
||||
+ ["@ldd_bin@", path.as_posix()],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
universal_newlines=True,
|
||||
@@ -209,7 +207,7 @@ def list_dependencies(path: pathlib.Path,
|
||||
|
||||
if unused:
|
||||
proc_unused = subprocess.Popen(
|
||||
- ["/usr/bin/env", "ldd", "--unused",
|
||||
+ ["@ldd_bin@", "--unused",
|
||||
path.as_posix()],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
Loading…
Reference in a new issue