From be723e5168cc6e42edef024032080f9de8bd0338 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 12 Nov 2021 23:38:28 +0100 Subject: [PATCH 1/3] python3Packages.tweepy: 4.0.1 -> 4.3.0 --- .../python-modules/tweepy/default.nix | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/tweepy/default.nix b/pkgs/development/python-modules/tweepy/default.nix index ee5c8582948d..7892975a45d9 100644 --- a/pkgs/development/python-modules/tweepy/default.nix +++ b/pkgs/development/python-modules/tweepy/default.nix @@ -1,20 +1,48 @@ -{ lib, buildPythonPackage, fetchPypi, requests, six, requests_oauthlib }: +{ lib +, aiohttp +, buildPythonPackage +, fetchFromGitHub +, oauthlib +, requests +, pythonOlder +, vcrpy +, pytestCheckHook +, requests_oauthlib +}: buildPythonPackage rec { pname = "tweepy"; - version = "4.0.1"; + version = "4.3.0"; + format = "setuptools"; - src = fetchPypi { - inherit pname version; - sha256 = "3bbb14a0ddef1ca8c9e8686ab2f647163afa02a6bab83507335ce647e9653a90"; + disabled = pythonOlder "3.6"; + + src = fetchFromGitHub { + owner = pname; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-lS/98DRpJH1UGGNzwqVVUJOeul+BX+I3e+ysmC0oL3I="; }; - doCheck = false; - propagatedBuildInputs = [ requests six requests_oauthlib ]; + propagatedBuildInputs = [ + aiohttp + oauthlib + requests + requests_oauthlib + ]; + + checkInputs = [ + pytestCheckHook + vcrpy + ]; + + pythonImportsCheck = [ + "tweepy" + ]; meta = with lib; { homepage = "https://github.com/tweepy/tweepy"; - description = "Twitter library for python"; + description = "Twitter library for Python"; license = licenses.mit; maintainers = with maintainers; [ ]; }; From c0cdc7d9046a08ad8db7238c5b7cffab5d62a7a0 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 13 Nov 2021 00:49:47 +0100 Subject: [PATCH 2/3] ioccheck: override tweepy --- pkgs/tools/security/ioccheck/default.nix | 30 ++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/security/ioccheck/default.nix b/pkgs/tools/security/ioccheck/default.nix index 455819ed1cf7..e936ab025fad 100644 --- a/pkgs/tools/security/ioccheck/default.nix +++ b/pkgs/tools/security/ioccheck/default.nix @@ -3,7 +3,29 @@ , python3 }: -python3.pkgs.buildPythonApplication rec { +let + py = python3.override { + packageOverrides = self: super: { + + # Support for later tweepy releases is missing + # https://github.com/ranguli/ioccheck/issues/70 + 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; + +buildPythonApplication rec { pname = "ioccheck"; version = "unstable-2021-09-29"; format = "pyproject"; @@ -15,11 +37,11 @@ python3.pkgs.buildPythonApplication rec { sha256 = "0lgqypcd5lzb2yqd5lr02pba24m26ghly4immxgz13svi8f6vzm9"; }; - nativeBuildInputs = with python3.pkgs; [ + nativeBuildInputs = with py.pkgs; [ poetry-core ]; - propagatedBuildInputs = with python3.pkgs; [ + propagatedBuildInputs = with py.pkgs; [ backoff click emoji @@ -34,7 +56,7 @@ python3.pkgs.buildPythonApplication rec { vt-py ]; - checkInputs = with python3.pkgs; [ + checkInputs = with py.pkgs; [ pytestCheckHook ]; From 5470dfc4ae86e01a33522c0a590114ddaaf399cb Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 13 Nov 2021 00:50:14 +0100 Subject: [PATCH 3/3] turses: override tweepy --- .../instant-messengers/turses/default.nix | 66 ++++++++++++++----- 1 file 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 256e026a060e..42dd9f835c9a 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; };