From 516a7f72a881c9dbd9d7711731195cb2a714143b Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Wed, 24 Mar 2021 11:54:42 +0100 Subject: [PATCH] python2Packages.chardet: keep 3.0.4 --- pkgs/development/python-modules/chardet/2.nix | 29 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 5 +++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/chardet/2.nix diff --git a/pkgs/development/python-modules/chardet/2.nix b/pkgs/development/python-modules/chardet/2.nix new file mode 100644 index 000000000000..65381d40268f --- /dev/null +++ b/pkgs/development/python-modules/chardet/2.nix @@ -0,0 +1,29 @@ +{ lib, buildPythonPackage, fetchPypi, fetchpatch +, pytest, pytestrunner, hypothesis }: + +buildPythonPackage rec { + pname = "chardet"; + version = "3.0.4"; + + src = fetchPypi { + inherit pname version; + sha256 = "1bpalpia6r5x1kknbk11p1fzph56fmmnp405ds8icksd3knr5aw4"; + }; + + patches = [ + # Add pytest 4 support. See: https://github.com/chardet/chardet/pull/174 + (fetchpatch { + url = "https://github.com/chardet/chardet/commit/0561ddcedcd12ea1f98b7ddedb93686ed8a5ffa4.patch"; + sha256 = "1y1xhjf32rdhq9sfz58pghwv794f3w2f2qcn8p6hp4pc8jsdrn2q"; + }) + ]; + + checkInputs = [ pytest pytestrunner hypothesis ]; + + meta = with lib; { + homepage = "https://github.com/chardet/chardet"; + description = "Universal encoding detector"; + license = licenses.lgpl2; + maintainers = with maintainers; [ domenkozar ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 80e9b27fc118..be95234ecf1c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1318,7 +1318,10 @@ in { characteristic = callPackage ../development/python-modules/characteristic { }; - chardet = callPackage ../development/python-modules/chardet { }; + chardet = if isPy3k then + callPackage ../development/python-modules/chardet { } + else + callPackage ../development/python-modules/chardet/2.nix { }; chart-studio = callPackage ../development/python-modules/chart-studio { };