about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/ansiwrap/default.nix
blob: 8dbfa99687c8673b4c4800804dfbfcf8ae90a152 (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
{ lib
, ansicolors
, buildPythonPackage
, fetchPypi
, pytestCheckHook
, pythonAtLeast
, pythonOlder
, textwrap3
}:

buildPythonPackage rec {
  pname = "ansiwrap";
  version = "0.8.4";
  format = "setuptools";

  disabled = pythonOlder "3.7" || pythonAtLeast "3.12";

  src = fetchPypi {
    inherit pname version;
    extension = "zip";
    sha256 = "ca0c740734cde59bf919f8ff2c386f74f9a369818cdc60efe94893d01ea8d9b7";
  };

  postPatch = ''
    # https://github.com/jonathaneunice/ansiwrap/issues/18
    substituteInPlace test/test_ansiwrap.py \
      --replace "set(range(20, 120)).difference(LINE_LENGTHS)" "sorted(set(range(20, 120)).difference(LINE_LENGTHS))" \
      --replace "set(range(120, 400)).difference(LINE_LENGTHS)" "sorted(set(range(120, 400)).difference(LINE_LENGTHS))"
  '';

  checkInputs = [
    ansicolors
    pytestCheckHook
  ];

  propagatedBuildInputs = [
    textwrap3
  ];

  pythonImportsCheck = [
    "ansiwrap"
  ];

  meta = with lib; {
    description = "Textwrap, but savvy to ANSI colors and styles";
    homepage = "https://github.com/jonathaneunice/ansiwrap";
    changelog = "https://github.com/jonathaneunice/ansiwrap/blob/master/CHANGES.yml";
    license = licenses.asl20;
    maintainers = with maintainers; [ ];
  };
}