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