From 05232abbbc6574b31a714bc34d9639676b83c1a8 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sat, 5 Jan 2019 11:43:12 +0100 Subject: [PATCH] python.pkgs.pkgconfig: hardcode path to pkg-config --- .../python-modules/pkgconfig/default.nix | 7 +++- .../python-modules/pkgconfig/executable.patch | 38 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/pkgconfig/executable.patch diff --git a/pkgs/development/python-modules/pkgconfig/default.nix b/pkgs/development/python-modules/pkgconfig/default.nix index 96c0ea566821..38098b432e45 100644 --- a/pkgs/development/python-modules/pkgconfig/default.nix +++ b/pkgs/development/python-modules/pkgconfig/default.nix @@ -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; diff --git a/pkgs/development/python-modules/pkgconfig/executable.patch b/pkgs/development/python-modules/pkgconfig/executable.patch new file mode 100644 index 000000000000..79fca7a44f1b --- /dev/null +++ b/pkgs/development/python-modules/pkgconfig/executable.patch @@ -0,0 +1,38 @@ +commit d8e0bac0c0d831510683939ec7a7b5bd72192423 +Author: Frederik Rietdijk +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 +