1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, poetry-core
6, pkg-config
7, pytestCheckHook
8}:
9
10buildPythonPackage rec {
11 pname = "pkgconfig";
12 version = "1.5.5";
13 format = "pyproject";
14
15 inherit (pkg-config)
16 setupHooks
17 wrapperName
18 suffixSalt
19 targetPrefix
20 baseBinName
21 ;
22
23 src = fetchFromGitHub {
24 owner = "matze";
25 repo = "pkgconfig";
26 rev = "v${version}";
27 hash = "sha256-uuLUGRNLCR3NS9g6OPCI+qG7tPWsLhI3OE5WmSI3vm8=";
28 };
29
30 postPatch = ''
31 substituteInPlace pkgconfig/pkgconfig.py \
32 --replace "pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'" "pkg_config_exe = '${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config'"
33
34 # those pc files are missing and pkg-config validates that they exist
35 substituteInPlace data/fake-openssl.pc \
36 --replace "Requires: libssl libcrypto" ""
37 '';
38
39 nativeBuildInputs = [ poetry-core ];
40
41 # ModuleNotFoundError: No module named 'distutils'
42 # https://github.com/matze/pkgconfig/issues/64
43 doCheck = pythonOlder "3.12";
44
45 nativeCheckInputs = [ pytestCheckHook ];
46
47 pythonImportsCheck = [ "pkgconfig" ];
48
49 meta = with lib; {
50 description = "Interface Python with pkg-config";
51 homepage = "https://github.com/matze/pkgconfig";
52 license = licenses.mit;
53 maintainers = with maintainers; [ nickcao ];
54 };
55}