python.pkgs.pkgconfig: hardcode path to pkg-config

This commit is contained in:
Frederik Rietdijk 2019-01-05 11:43:12 +01:00 committed by Frederik Rietdijk
parent c5d99308de
commit 05232abbbc
2 changed files with 44 additions and 1 deletions

View File

@ -11,12 +11,17 @@ buildPythonPackage rec {
checkInputs = [ nose ];
propagatedBuildInputs = [ pkgconfig ];
nativeBuildInputs = [ pkgconfig ];
checkPhase = ''
nosetests
'';
patches = [ ./executable.patch ];
postPatch = ''
substituteInPlace pkgconfig/pkgconfig.py --replace 'PKG_CONFIG_EXE = "pkg-config"' 'PKG_CONFIG_EXE = "${pkgconfig}/bin/pkg-config"'
'';
meta = with lib; {
description = "Interface Python with pkg-config";
homepage = https://github.com/matze/pkgconfig;

View File

@ -0,0 +1,38 @@
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