1{
2 lib,
3 ansicolors,
4 buildPythonPackage,
5 fetchPypi,
6 pytestCheckHook,
7 pythonAtLeast,
8 pythonOlder,
9 setuptools,
10 textwrap3,
11}:
12
13buildPythonPackage rec {
14 pname = "ansiwrap";
15 version = "0.8.4";
16 pyproject = true;
17
18 disabled = pythonOlder "3.7" || pythonAtLeast "3.12";
19
20 src = fetchPypi {
21 inherit pname version;
22 extension = "zip";
23 hash = "sha256-ygx0BzTN5Zv5Gfj/LDhvdPmjaYGM3GDv6UiT0B6o2bc=";
24 };
25
26 postPatch = ''
27 # https://github.com/jonathaneunice/ansiwrap/issues/18
28 substituteInPlace test/test_ansiwrap.py \
29 --replace-fail "set(range(20, 120)).difference(LINE_LENGTHS)" "sorted(set(range(20, 120)).difference(LINE_LENGTHS))" \
30 --replace-fail "set(range(120, 400)).difference(LINE_LENGTHS)" "sorted(set(range(120, 400)).difference(LINE_LENGTHS))"
31 '';
32
33 build-system = [ setuptools ];
34
35 dependencies = [ textwrap3 ];
36
37 nativeCheckInputs = [
38 ansicolors
39 pytestCheckHook
40 ];
41
42 pythonImportsCheck = [ "ansiwrap" ];
43
44 meta = with lib; {
45 description = "Textwrap, but savvy to ANSI colors and styles";
46 homepage = "https://github.com/jonathaneunice/ansiwrap";
47 changelog = "https://github.com/jonathaneunice/ansiwrap/blob/master/CHANGES.yml";
48 license = licenses.asl20;
49 maintainers = with maintainers; [ ];
50 };
51}