summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/rainbowstream/default.nix
blob: a99caaf67a2c87252976c178a06a11bf7ec393bb (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
  lib,
  arrow,
  buildPythonPackage,
  fetchFromGitHub,
  freetype,
  glibcLocales,
  libjpeg,
  pillow,
  pocket,
  pyfiglet,
  pysocks,
  python,
  python-dateutil,
  requests,
  twitter,
  zlib,
}:

buildPythonPackage {
  pname = "rainbowstream";
  version = "1.5.5";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "orakaro";
    repo = "rainbowstream";
    # Request for tagging, https://github.com/orakaro/rainbowstream/issues/314
    rev = "96141fac10675e0775d703f65a59c4477a48c57e";
    sha256 = "0j0qcc428lk9b3l0cr2j418gd6wd5k4160ham2zn2mmdmxn5bldg";
  };

  buildInputs = [
    freetype
    glibcLocales
    libjpeg
    zlib
  ];

  propagatedBuildInputs = [
    arrow
    pillow
    pocket
    pyfiglet
    pysocks
    python-dateutil
    requests
    twitter
  ];

  patches = [ ./image.patch ];

  postPatch = ''
    clib=$out/${python.sitePackages}/rainbowstream/image.so
    substituteInPlace rainbowstream/c_image.py \
      --replace @CLIB@ $clib
    sed -i 's/requests.*"/requests"/' setup.py
  '';

  LC_ALL = "en_US.UTF-8";

  postInstall = ''
    mkdir -p $out/lib
    cc -fPIC -shared -o $clib rainbowstream/image.c
    for prog in "$out/bin/"*; do
      wrapProgram "$prog" \
        --prefix PYTHONPATH : "$PYTHONPATH"
    done
  '';

  # Project has no tests
  doCheck = false;

  pythonImportsCheck = [ "rainbowstream" ];

  meta = {
    description = "Streaming command-line twitter client";
    mainProgram = "rainbowstream";
    homepage = "https://github.com/orakaro/rainbowstream";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ thoughtpolice ];
  };
}