From b0181718cb5b3f4356a2e62bf56a882c08cd0da8 Mon Sep 17 00:00:00 2001
From: Timo Kaufmann <eisfreak7@gmail.com>
Date: Wed, 27 Jun 2018 09:55:01 +0200
Subject: [PATCH] python2Packages.rpy2: fix python2 compatibility (#42634)

---
 pkgs/development/python-modules/rpy2/default.nix | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/python-modules/rpy2/default.nix b/pkgs/development/python-modules/rpy2/default.nix
index c6ece5f03038..f907f72ff244 100644
--- a/pkgs/development/python-modules/rpy2/default.nix
+++ b/pkgs/development/python-modules/rpy2/default.nix
@@ -2,6 +2,7 @@
 , buildPythonPackage
 , fetchPypi
 , isPyPy
+, isPy27
 , readline
 , R
 , pcre
@@ -16,12 +17,18 @@
 }:
 
 buildPythonPackage rec {
-    version = "2.9.3";
+    version = if isPy27 then
+      "2.8.6" # python2 support dropped in 2.9.x
+    else
+      "2.9.3";
     pname = "rpy2";
     disabled = isPyPy;
     src = fetchPypi {
       inherit version pname;
-      sha256 = "1b72958e683339ea0c3bd9f73738e9ece2da8da8008a10e2e0c68fc7864e9361";
+      sha256 = if isPy27 then
+        "162zki5c1apgv6qbafi7n66y4hgpgp43xag7q75qb6kv99ri6k80" # 2.8.x
+      else
+        "1b72958e683339ea0c3bd9f73738e9ece2da8da8008a10e2e0c68fc7864e9361"; # 2.9.x
     };
     buildInputs = [
       readline