From 8dadb44196a07f6b4ab42b16fdb64f2fcc3fc94c Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Fri, 28 Oct 2016 13:31:07 +0200 Subject: [PATCH] pythonPackages: use fixed-point combinator Use a fixed-point combinator for the Python package set to allow easier overriding of its contents. Earlier implementations were proposed in #16784 and #17428. This commit is by comparison much smaller and changes only what is needed. --- pkgs/top-level/all-packages.nix | 7 ------- pkgs/top-level/python-packages.nix | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 34d24a89ff7e..e0b0656a59e7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9897,37 +9897,30 @@ in # regardless. python26Packages = callPackage ./python-packages.nix { python = python26; - self = python26Packages; }; python27Packages = lib.hiPrioSet (recurseIntoAttrs (callPackage ./python-packages.nix { python = python27; - self = python27Packages; })); python33Packages = callPackage ./python-packages.nix { python = python33; - self = python33Packages; }; python34Packages = callPackage ./python-packages.nix { python = python34; - self = python34Packages; }; python35Packages = recurseIntoAttrs (callPackage ./python-packages.nix { python = python35; - self = python35Packages; }); python36Packages = (callPackage ./python-packages.nix { python = python36; - self = python36Packages; }); pypyPackages = callPackage ./python-packages.nix { python = pypy; - self = pypyPackages; }; ### DEVELOPMENT / R MODULES diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index fc5972bfbf0f..ca2e88da94e4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1,7 +1,14 @@ -{ pkgs, stdenv, python, self }: +{ pkgs +, stdenv +, python +, overrides ? (self: super: {}) +}: with pkgs.lib; +let + packages = ( self: + let pythonAtLeast = versionAtLeast python.pythonVersion; pythonOlder = versionOlder python.pythonVersion; @@ -31323,4 +31330,7 @@ in { zeitgeist = if isPy3k then throw "zeitgeist not supported for interpreter ${python.executable}" else (pkgs.zeitgeist.override{python2Packages=self;}).py; -} + +}); + +in fix' (extends overrides packages)