summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/libversion/default.nix
blob: 336110b388bde33f5aa4d2e277afc6991eab8b9c (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  libversion,
  pkg-config,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "libversion";
  version = "1.2.4";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "repology";
    repo = "py-libversion";
    rev = version;
    hash = "sha256-p0wtSB+QXAERf+57MMb8cqWoy1bG3XaCpR9GPwYYvJM=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace "'pkg-config'" "'$(command -v $PKG_CONFIG)'"
  '';

  nativeBuildInputs = [ pkg-config ];

  buildInputs = [ libversion ];

  nativeCheckInputs = [ pytestCheckHook ];

  preCheck = ''
    # import from $out
    rm -r libversion
  '';

  pythonImportsCheck = [ "libversion" ];

  meta = {
    description = "Python bindings for libversion, which provides fast, powerful and correct generic version string comparison algorithm";
    homepage = "https://github.com/repology/py-libversion";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ ryantm ];
  };
}