python310Packages.pkgconfig: fix pkg-config not always being in PATH
This commit is contained in:
parent
9b1bedf5f1
commit
d5beaa1a93
|
@ -26,12 +26,9 @@ buildPythonPackage rec {
|
|||
sha256 = "sha256-uuLUGRNLCR3NS9g6OPCI+qG7tPWsLhI3OE5WmSI3vm8=";
|
||||
};
|
||||
|
||||
patches = [ ./executable.patch ];
|
||||
|
||||
postPatch = ''
|
||||
rm pkgconfig/pkgconfig.py.orig
|
||||
substituteInPlace pkgconfig/pkgconfig.py \
|
||||
--replace 'PKG_CONFIG_EXE = "pkg-config"' 'PKG_CONFIG_EXE = "${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config"'
|
||||
--replace "pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'" "pkg_config_exe = '${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config'"
|
||||
|
||||
# those pc files are missing and pkg-config validates that they exist
|
||||
substituteInPlace data/fake-openssl.pc \
|
||||
|
@ -40,8 +37,6 @@ buildPythonPackage rec {
|
|||
|
||||
nativeBuildInputs = [ poetry-core ];
|
||||
|
||||
propagatedNativeBuildInputs = [ pkg-config ];
|
||||
|
||||
checkInputs = [ pytestCheckHook ];
|
||||
|
||||
pythonImportsCheck = [ "pkgconfig" ];
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
commit d8e0bac0c0d831510683939ec7a7b5bd72192423
|
||||
Author: Frederik Rietdijk <fridh@fridh.nl>
|
||||
Date: Sat Jan 5 11:38:28 2019 +0100
|
||||
|
||||
Have a top-level attribute for the executable
|
||||
|
||||
diff --git a/pkgconfig/pkgconfig.py b/pkgconfig/pkgconfig.py
|
||||
index 3deb97f..e7c5561 100644
|
||||
--- a/pkgconfig/pkgconfig.py
|
||||
+++ b/pkgconfig/pkgconfig.py
|
||||
@@ -30,6 +30,9 @@ from functools import wraps
|
||||
from subprocess import call, PIPE, Popen
|
||||
|
||||
|
||||
+PKG_CONFIG_EXE = "pkg-config"
|
||||
+
|
||||
+
|
||||
def _compare_versions(v1, v2):
|
||||
"""
|
||||
Compare two version strings and return -1, 0 or 1 depending on the equality
|
||||
@@ -65,7 +68,7 @@ def _convert_error(func):
|
||||
|
||||
@_convert_error
|
||||
def _query(package, *options):
|
||||
- pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
|
||||
+ pkg_config_exe = os.environ.get('PKG_CONFIG', None) or PKG_CONFIG_EXE
|
||||
cmd = '{0} {1} {2}'.format(pkg_config_exe, ' '.join(options), package)
|
||||
proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE)
|
||||
out, err = proc.communicate()
|
||||
@@ -84,7 +87,7 @@ def exists(package):
|
||||
|
||||
If ``pkg-config`` not on path, raises ``EnvironmentError``.
|
||||
"""
|
||||
- pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
|
||||
+ pkg_config_exe = os.environ.get('PKG_CONFIG', None) or PKG_CONFIG_EXE
|
||||
cmd = '{0} --exists {1}'.format(pkg_config_exe, package).split()
|
||||
return call(cmd) == 0
|
||||
|
Loading…
Reference in a new issue