summary refs log tree commit diff
path: root/pkgs/development/python-modules/pkgconfig/default.nix
blob: 6721390d7abb890cb3d0580239c81e8efefb6a3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ lib
, buildPythonPackage
, fetchFromGitHub
, poetry-core
, pkg-config
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "pkgconfig";
  version = "1.5.5";
  format = "pyproject";

  inherit (pkg-config)
    setupHooks
    wrapperName
    suffixSalt
    targetPrefix
    baseBinName
    ;

  src = fetchFromGitHub {
    owner = "matze";
    repo = "pkgconfig";
    rev = "v${version}";
    sha256 = "sha256-uuLUGRNLCR3NS9g6OPCI+qG7tPWsLhI3OE5WmSI3vm8=";
  };

  postPatch = ''
    substituteInPlace pkgconfig/pkgconfig.py \
      --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 \
      --replace "Requires: libssl libcrypto" ""
  '';

  nativeBuildInputs = [ poetry-core ];

  checkInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "pkgconfig" ];

  meta = with lib; {
    description = "Interface Python with pkg-config";
    homepage = "https://github.com/matze/pkgconfig";
    license = licenses.mit;
    maintainers = with maintainers; [ SuperSandro2000 ];
  };
}