about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pyutil/default.nix
blob: 91f5d0d89f89431e19effc8ce554a0540e134a80 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{ lib
, buildPythonPackage
, fetchPypi
, isPyPy
, mock
, pytestCheckHook
, pythonAtLeast
, pythonOlder
, setuptools
, simplejson
, twisted
, versioneer
}:

buildPythonPackage rec {
  pname = "pyutil";
  version = "3.3.6";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-XcPWu5xbq6u10Ldz4JQEXXVxLos0ry0psOKGAmaCZ8A=";
  };

  prePatch = lib.optionalString isPyPy ''
    grep -rl 'utf-8-with-signature-unix' ./ | xargs sed -i -e "s|utf-8-with-signature-unix|utf-8|g"
  '';

  nativeBuildInputs = [
    setuptools
    versioneer
  ];

  passthru.optional-dependencies = {
    jsonutil = [
      simplejson
    ];
    # Module not available
    # randcookie = [
    #   zbase32
    # ];
  };

  nativeCheckInputs = [
    mock
    twisted
    pytestCheckHook
  ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);

  pythonImportsCheck = [
    "pyutil"
  ];

  disabledTests = lib.optionals (pythonAtLeast "3.12") [
    # https://github.com/tpltnt/pyutil/issues/10
    "test_decimal"
    "test_float"
  ];

  meta = with lib; {
    description = "Collection of mature utilities for Python programmers";
    longDescription = ''
      These are a few data structures, classes and functions which
      we've needed over many years of Python programming and which
      seem to be of general use to other Python programmers. Many of
      the modules that have existed in pyutil over the years have
      subsequently been obsoleted by new features added to the
      Python language or its standard library, thus showing that
      we're not alone in wanting tools like these.
    '';
    homepage = "https://github.com/tpltnt/pyutil";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ prusnak ];
  };

}