diff options
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/rainbowstream')
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/rainbowstream/default.nix | 54 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/rainbowstream/image.patch | 18 |
2 files changed, 72 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/rainbowstream/default.nix b/nixpkgs/pkgs/development/python-modules/rainbowstream/default.nix new file mode 100644 index 000000000000..ca6e4614f33d --- /dev/null +++ b/nixpkgs/pkgs/development/python-modules/rainbowstream/default.nix @@ -0,0 +1,54 @@ +{ stdenv +, buildPythonPackage +, fetchPypi +, python +, pkgs +, pillow +, twitter +, pyfiglet +, requests +, arrow +, dateutil +, pysocks +, pocket +}: + +buildPythonPackage rec { + pname = "rainbowstream"; + version = "1.4.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "16881d8bb15416389eeaf4ceee7a588069060c216b55e7602dbcff5134feb7cc"; + }; + + 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 + ''; + + buildInputs = [ pkgs.libjpeg pkgs.freetype pkgs.zlib pkgs.glibcLocales pillow twitter pyfiglet requests arrow dateutil pysocks pocket ]; + + meta = with stdenv.lib; { + description = "Streaming command-line twitter client"; + homepage = "http://www.rainbowstream.org/"; + license = licenses.mit; + maintainers = with maintainers; [ thoughtpolice ]; + }; + +} diff --git a/nixpkgs/pkgs/development/python-modules/rainbowstream/image.patch b/nixpkgs/pkgs/development/python-modules/rainbowstream/image.patch new file mode 100644 index 000000000000..215152ae4fb1 --- /dev/null +++ b/nixpkgs/pkgs/development/python-modules/rainbowstream/image.patch @@ -0,0 +1,18 @@ +diff --git a/rainbowstream/c_image.py b/rainbowstream/c_image.py +index f050150..a0fb77d 100644 +--- a/rainbowstream/c_image.py ++++ b/rainbowstream/c_image.py +@@ -12,11 +12,7 @@ def call_c(): + """ + Call the C program for converting RGB to Ansi colors + """ +- library = expanduser('~/.image.so') +- sauce = join(dirname(__file__), 'image.c') +- if not exists(library) or getmtime(sauce) > getmtime(library): +- build = "cc -fPIC -shared -o %s %s" % (library, sauce) +- os.system(build + " >/dev/null 2>&1") ++ library = '@CLIB@' + image_c = ctypes.cdll.LoadLibrary(library) + image_c.init() + return image_c.rgb_to_ansi + |