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 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
50
51 pythonImportsCheck = [ "pyutil" ];
52
53 disabledTests = lib.optionals (pythonAtLeast "3.12") [
54 # https://github.com/tpltnt/pyutil/issues/10
55 "test_decimal"
56 "test_float"
57 ];
58
59 meta = with lib; {
60 description = "Collection of mature utilities for Python programmers";
61 longDescription = ''
62 These are a few data structures, classes and functions which
63 we've needed over many years of Python programming and which
64 seem to be of general use to other Python programmers. Many of
65 the modules that have existed in pyutil over the years have
66 subsequently been obsoleted by new features added to the
67 Python language or its standard library, thus showing that
68 we're not alone in wanting tools like these.
69 '';
70 homepage = "https://github.com/tpltnt/pyutil";
71 license = licenses.gpl2Plus;
72 maintainers = with maintainers; [ prusnak ];
73 };
74}