From 2efb099c009ae257e85381d76f470ca2569658a6 Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Thu, 27 Apr 2017 09:09:04 +0000 Subject: [PATCH] pythonPackages.ipython: support python2 Fixes #25234 --- pkgs/development/python-modules/ipython/5.nix | 65 +++++++++++++++++++ .../python-modules/ipython/default.nix | 4 +- pkgs/top-level/python-packages.nix | 7 +- 3 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/python-modules/ipython/5.nix diff --git a/pkgs/development/python-modules/ipython/5.nix b/pkgs/development/python-modules/ipython/5.nix new file mode 100644 index 00000000000..011c8665290 --- /dev/null +++ b/pkgs/development/python-modules/ipython/5.nix @@ -0,0 +1,65 @@ +{ lib +, stdenv +, buildPythonPackage +, fetchPypi +, pythonOlder +# Build dependencies +, glibcLocales +# Test dependencies +, nose +, pygments +, testpath +, isPy27 +, mock +# Runtime dependencies +, backports_shutil_get_terminal_size +, jedi +, decorator +, pathlib2 +, pickleshare +, requests2 +, simplegeneric +, traitlets +, prompt_toolkit +, pexpect +, appnope +}: + +buildPythonPackage rec { + pname = "ipython"; + version = "5.3.0"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "bf5e615e7d96dac5a61fbf98d9e2926d98aa55582681bea7e9382992a3f43c1d"; + }; + + prePatch = stdenv.lib.optionalString stdenv.isDarwin '' + substituteInPlace setup.py --replace "'gnureadline'" " " + ''; + + buildInputs = [ glibcLocales ]; + + checkInputs = [ nose pygments testpath ] ++ lib.optional isPy27 mock; + + propagatedBuildInputs = [ + backports_shutil_get_terminal_size decorator pickleshare prompt_toolkit + simplegeneric traitlets requests2 pathlib2 pexpect + ] ++ lib.optionals stdenv.isDarwin [ appnope ]; + + LC_ALL="en_US.UTF-8"; + + doCheck = false; # Circular dependency with ipykernel + + checkPhase = '' + nosetests + ''; + + meta = { + description = "IPython: Productive Interactive Computing"; + homepage = http://ipython.org/; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ bjornfor jgeerds orivej lnl7 ]; + }; +} diff --git a/pkgs/development/python-modules/ipython/default.nix b/pkgs/development/python-modules/ipython/default.nix index 0823a76e2a6..de7d0a8d81b 100644 --- a/pkgs/development/python-modules/ipython/default.nix +++ b/pkgs/development/python-modules/ipython/default.nix @@ -8,8 +8,6 @@ # Test dependencies , nose , pygments -, isPy27 -, mock # Runtime dependencies , jedi , decorator @@ -37,7 +35,7 @@ buildPythonPackage rec { buildInputs = [ glibcLocales ]; - checkInputs = [ nose pygments ] ++ lib.optional isPy27 mock; + checkInputs = [ nose pygments ]; propagatedBuildInputs = [ jedi diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 84f1c2380e4..865a7512b91 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13243,7 +13243,12 @@ in { ipyparallel = callPackage ../development/python-modules/ipyparallel { }; - ipython = callPackage ../development/python-modules/ipython { }; + # Newer versions of IPython no longer support Python 2.7. + ipython = if isPy27 then self.ipython_5 else self.ipython_6; + + ipython_5 = callPackage ../development/python-modules/ipython/5.nix { }; + + ipython_6 = callPackage ../development/python-modules/ipython { }; ipython_genutils = buildPythonPackage rec { version = "0.2.0";