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