about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/turses
diff options
context:
space:
mode:
authorFabian Affolter <mail@fabian-affolter.ch>2021-11-13 00:50:14 +0100
committerFabian Affolter <mail@fabian-affolter.ch>2021-11-13 00:50:14 +0100
commit5470dfc4ae86e01a33522c0a590114ddaaf399cb (patch)
treea0f58cd2360b0d7dce74d96d703c97b5f7fdbfb5 /pkgs/applications/networking/instant-messengers/turses
parentc0cdc7d9046a08ad8db7238c5b7cffab5d62a7a0 (diff)
turses: override tweepy
Diffstat (limited to 'pkgs/applications/networking/instant-messengers/turses')
-rw-r--r--pkgs/applications/networking/instant-messengers/turses/default.nix66
1 files changed, 51 insertions, 15 deletions
diff --git a/pkgs/applications/networking/instant-messengers/turses/default.nix b/pkgs/applications/networking/instant-messengers/turses/default.nix
index 256e026a060e0..42dd9f835c9ad 100644
--- a/pkgs/applications/networking/instant-messengers/turses/default.nix
+++ b/pkgs/applications/networking/instant-messengers/turses/default.nix
@@ -1,7 +1,30 @@
-{ lib, fetchpatch, python3Packages }:
+{ lib
+, fetchpatch
+, fetchFromGitHub
+, python3
+}:
 
-with lib;
-with python3Packages;
+let
+  py = python3.override {
+    packageOverrides = self: super: {
+
+      # Support for later tweepy releases is missing
+      # https://github.com/louipc/turses/issues/12
+      tweepy = super.tweepy.overridePythonAttrs (oldAttrs: rec {
+        version = "3.10.0";
+
+        src = fetchFromGitHub {
+          owner = "tweepy";
+          repo = "tweepy";
+          rev = "v${version}";
+          sha256 = "0k4bdlwjna6f1k19jki4xqgckrinkkw8b9wihzymr1l04rwd05nw";
+        };
+        doCheck = false;
+      });
+    };
+  };
+in
+with py.pkgs;
 
 buildPythonPackage rec {
   pname = "turses";
@@ -12,8 +35,18 @@ buildPythonPackage rec {
     sha256 = "15mkhm3b5ka42h8qph0mhh8izfc1200v7651c62k7ldcs50ib9j6";
   };
 
-  checkInputs = [ mock pytest coverage tox ];
-  propagatedBuildInputs = [ urwid tweepy future ];
+  propagatedBuildInputs = with py.pkgs; [
+    urwid
+    tweepy
+    future
+  ];
+
+  checkInputs = with py.pkgs; [
+    mock
+    pytest
+    coverage
+    tox
+  ];
 
   LC_ALL = "en_US.UTF-8";
 
@@ -29,6 +62,17 @@ buildPythonPackage rec {
     })
   ];
 
+  postPatch = ''
+    substituteInPlace setup.py \
+      --replace "urwid==1.3.0" "urwid" \
+      --replace "future==0.14.3" "future" \
+      --replace "tweepy==3.3.0" "tweepy"
+    substituteInPlace tests/test_config.py \
+      --replace "config.generate_config_file.assert_called_once()" "assert config.generate_config_file.call_count == 1"
+    substituteInPlace tests/test_meta.py \
+      --replace "self.observer.update.assert_called_once()" "assert self.observer.update.call_count == 1"
+  '';
+
   checkPhase = ''
     TMP_TURSES=`echo turses-$RANDOM`
     mkdir $TMP_TURSES
@@ -36,18 +80,10 @@ buildPythonPackage rec {
     rm -rf $TMP_TURSES
   '';
 
-  postPatch = ''
-    sed -i -e 's|urwid==1.3.0|urwid==${getVersion urwid}|' setup.py
-    sed -i -e "s|future==0.14.3|future==${getVersion future}|" setup.py
-    sed -i -e "s|tweepy==3.3.0|tweepy==${getVersion tweepy}|" setup.py
-    sed -i -e "s|config.generate_config_file.assert_called_once()|assert config.generate_config_file.call_count == 1|" tests/test_config.py
-    sed -i -e "s|self.observer.update.assert_called_once()|assert self.observer.update.call_count == 1|" tests/test_meta.py
-  '';
-
   meta = with lib; {
-    homepage = "https://github.com/louipc/turses";
     description = "A Twitter client for the console";
-    license = licenses.gpl3;
+    homepage = "https://github.com/louipc/turses";
+    license = licenses.gpl3Only;
     maintainers = with maintainers; [ ];
     platforms = platforms.unix;
   };