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