From db3ffaa8f0e335c305936313fb658a7482c283cc Mon Sep 17 00:00:00 2001 From: Allen Nelson Date: Mon, 25 Apr 2016 11:55:43 -0500 Subject: [PATCH 1/2] httpretty: working build for python3 --- .../python-modules/httpretty/setup.py.patch | 11 +++++++++++ pkgs/top-level/python-packages.nix | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/httpretty/setup.py.patch diff --git a/pkgs/development/python-modules/httpretty/setup.py.patch b/pkgs/development/python-modules/httpretty/setup.py.patch new file mode 100644 index 00000000000..e07ba931705 --- /dev/null +++ b/pkgs/development/python-modules/httpretty/setup.py.patch @@ -0,0 +1,11 @@ +--- setup.py 2016-04-18 10:44:27.915536022 -0500 ++++ setup-new.py 2016-04-18 10:44:13.515537377 -0500 +@@ -75,7 +75,7 @@ + + + local_file = lambda *f: \ +- open(os.path.join(os.path.dirname(__file__), *f)).read() ++ open(os.path.join(os.path.dirname(__file__), *f), encoding="utf-8").read() + + + install_requires, dependency_links = \ diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 9e3605827d3..89b8bebf9c0 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10420,7 +10420,6 @@ in modules // { httpretty = buildPythonPackage rec { name = "httpretty-${version}"; version = "0.8.6"; - disabled = isPy3k; doCheck = false; src = pkgs.fetchurl { @@ -10442,6 +10441,9 @@ in modules // { --- 566 ---- ! 'content-length': str(len(self.body)) DIFF + + # Explicit encoding flag is required with python3, unless locale is set. + patch -p0 -i ${../development/python-modules/httpretty/setup.py.patch} ''; meta = { From a3ef1ad66c7867f78e64eca8352ab20ac53bac23 Mon Sep 17 00:00:00 2001 From: Allen Nelson Date: Mon, 25 Apr 2016 12:25:01 -0500 Subject: [PATCH 2/2] httpretty: make patch conditional on python version --- pkgs/top-level/python-packages.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 89b8bebf9c0..87dab9a52c8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10443,7 +10443,8 @@ in modules // { DIFF # Explicit encoding flag is required with python3, unless locale is set. - patch -p0 -i ${../development/python-modules/httpretty/setup.py.patch} + ${if !self.isPy3k then "" else + "patch -p0 -i ${../development/python-modules/httpretty/setup.py.patch}"} ''; meta = {