From 2f977b4af111288318bab3823e850ebe9aef3af6 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Thu, 29 Dec 2016 09:23:43 +0100 Subject: [PATCH] pythonPackages.bleach: 1.4.3 -> 1.5.0, closes #21450 Unfortunately bleach depends on an older version of html5lib and cannot use the latest version because the sanitizer module has been moved out. https://github.com/mozilla/bleach/issues/217 --- pkgs/top-level/python-packages.nix | 34 ++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 4a3a7c6e3c92..15496a9dcc19 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2808,17 +2808,39 @@ in { }; }; + # Needed for bleach 1.5.0 + html5lib_0_9999999 = self.html5lib.override rec { + name = "html5lib-${version}"; + buildInputs = with self; [ nose flake8 ]; + propagatedBuildInputs = with self; [ six ]; + checkPhase = '' + nosetests + ''; + + version = "0.9999999"; + src = pkgs.fetchurl { + url = "https://github.com/html5lib/html5lib-python/archive/0.9999999.tar.gz"; + sha256 = "1s6wdbrjzw5jhyfbskf4nj1i5bjpjqq9f89a7r1rl59rhpwmfhhq"; + }; + }; + bleach = buildPythonPackage rec { - version = "v1.4.3"; - name = "bleach-${version}"; + pname = "bleach"; + version = "1.5.0"; + name = "${pname}-${version}"; src = pkgs.fetchurl { - url = "http://github.com/jsocol/bleach/archive/${version}.tar.gz"; - sha256 = "0mk8780ilip0m890rapbckngw8k42gca3551kri297pyylr06l5m"; + url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${name}.tar.gz"; + sha256 = "978e758599b54cd3caa2e160d74102879b230ea8dc93871d0783721eef58bc65"; }; - buildInputs = with self; [ nose ]; - propagatedBuildInputs = with self; [ six html5lib ]; + buildInputs = with self; [ pytest pytestrunner ]; + propagatedBuildInputs = with self; [ six html5lib_0_9999999 ]; + + postPatch = '' + substituteInPlace setup.py --replace "==3.0.3" "" + substituteInPlace setup.py --replace ">=0.999,!=0.9999,!=0.99999,<0.99999999" "" + ''; meta = { description = "An easy, HTML5, whitelisting HTML sanitizer";