From f244b35d339c183255f563ba86ef2a22b3cf6f9c Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 18 Mar 2021 22:31:47 +0100 Subject: nix: add googletranx.nix --- default.nix | 6 ++---- nix/googletranx.nix | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 nix/googletranx.nix diff --git a/default.nix b/default.nix index adf3a21..5fcc977 100644 --- a/default.nix +++ b/default.nix @@ -7,10 +7,8 @@ python3.pkgs.buildPythonPackage { matrix-client = (stdenv.lib.overrideDerivation matrix-client (self: { patches = [ ./nix/badsync.patch ]; })); - }) - (stdenv.lib.overrideDerivation googletrans (self: { - patches = [ ./nix/translate.patch ]; - })) + }) + (callPackage ./nix/googletranx.nix {}) ]; checkInputs = [ python3.pkgs.black ]; } diff --git a/nix/googletranx.nix b/nix/googletranx.nix new file mode 100644 index 0000000..8326d17 --- /dev/null +++ b/nix/googletranx.nix @@ -0,0 +1,39 @@ +{ lib, buildPythonPackage, httpx, fetchFromGitHub, requests, pytest, coveralls }: + +buildPythonPackage rec { + pname = "googletrans"; + version = "2020-08-02"; + + src = fetchFromGitHub { + owner = "ssut"; + repo = "py-googletrans"; + rev = "4f7c079"; + sha256 = "0jj3a1bhq88x4lg32xch0kna8i88wkrywywmm3ic81zvlb6yyipk"; + }; + + propagatedBuildInputs = [ + requests + httpx + ]; + + prePatch = '' + sed -i 's/==/>=/' setup.py + ''; + + checkInputs = [ pytest coveralls ]; + + # majority of tests just try to ping Google's Translate API endpoint + doCheck = false; + checkPhase = '' + pytest + ''; + + pythonImportsCheck = [ "googletrans" ]; + + meta = with lib; { + description = "Googletrans is python library to interact with Google Translate API"; + homepage = "https://py-googletrans.readthedocs.io"; + license = licenses.mit; + maintainers = with maintainers; [ unode ]; + }; +} -- cgit v1.2.3