1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 libversion,
6 pkg-config,
7 pytestCheckHook,
8 pythonOlder,
9}:
10
11buildPythonPackage rec {
12 pname = "libversion";
13 version = "1.2.4";
14 format = "setuptools";
15
16 disabled = pythonOlder "3.6";
17
18 src = fetchFromGitHub {
19 owner = "repology";
20 repo = "py-libversion";
21 rev = version;
22 hash = "sha256-p0wtSB+QXAERf+57MMb8cqWoy1bG3XaCpR9GPwYYvJM=";
23 };
24
25 postPatch = ''
26 substituteInPlace setup.py \
27 --replace "'pkg-config'" "'$(command -v $PKG_CONFIG)'"
28 '';
29
30 nativeBuildInputs = [ pkg-config ];
31
32 buildInputs = [ libversion ];
33
34 nativeCheckInputs = [ pytestCheckHook ];
35
36 preCheck = ''
37 # import from $out
38 rm -r libversion
39 '';
40
41 pythonImportsCheck = [ "libversion" ];
42
43 meta = with lib; {
44 description = "Python bindings for libversion, which provides fast, powerful and correct generic version string comparison algorithm";
45 homepage = "https://github.com/repology/py-libversion";
46 license = licenses.mit;
47 maintainers = with maintainers; [ ryantm ];
48 };
49}