1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 isPyPy,
6 mock,
7 pytestCheckHook,
8 pythonAtLeast,
9 pythonOlder,
10 setuptools,
11 simplejson,
12 twisted,
13 versioneer,
14}:
15
16buildPythonPackage rec {
17 pname = "pyutil";
18 version = "3.3.6";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchPypi {
24 inherit pname version;
25 hash = "sha256-XcPWu5xbq6u10Ldz4JQEXXVxLos0ry0psOKGAmaCZ8A=";
26 };
27
28 prePatch = lib.optionalString isPyPy ''
29 grep -rl 'utf-8-with-signature-unix' ./ | xargs sed -i -e "s|utf-8-with-signature-unix|utf-8|g"
30 '';
31
32 nativeBuildInputs = [
33 setuptools
34 versioneer
35 ];
36
37 optional-dependencies = {
38 jsonutil = [ simplejson ];
39 # Module not available
40 # randcookie = [
41 # zbase32
42 # ];
43 };
44
45 nativeCheckInputs = [
46 mock
47 twisted
48 pytestCheckHook
49 ]
50 ++ lib.flatten (builtins.attrValues optional-dependencies);
51
52 pythonImportsCheck = [ "pyutil" ];
53
54 disabledTests = lib.optionals (pythonAtLeast "3.12") [
55 # https://github.com/tpltnt/pyutil/issues/10
56 "test_decimal"
57 "test_float"
58 ];
59
60 meta = with lib; {
61 description = "Collection of mature utilities for Python programmers";
62 longDescription = ''
63 These are a few data structures, classes and functions which
64 we've needed over many years of Python programming and which
65 seem to be of general use to other Python programmers. Many of
66 the modules that have existed in pyutil over the years have
67 subsequently been obsoleted by new features added to the
68 Python language or its standard library, thus showing that
69 we're not alone in wanting tools like these.
70 '';
71 homepage = "https://github.com/tpltnt/pyutil";
72 license = licenses.gpl2Plus;
73 maintainers = with maintainers; [ prusnak ];
74 };
75}