python: add python.withPackages function

Fixes #15801
This commit is contained in:
Benno Fünfstück 2016-05-29 15:12:23 +02:00
parent 41fa133548
commit c3ed3914bb
6 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,6 @@
{ stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, includeModules ? false { stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, includeModules ? false
, sqlite, tcl, tk, xlibsWrapper, openssl, readline, db, ncurses, gdbm, self, callPackage }: , sqlite, tcl, tk, xlibsWrapper, openssl, readline, db, ncurses, gdbm, self, callPackage
, python26Packages }:
assert zlibSupport -> zlib != null; assert zlibSupport -> zlib != null;
@ -97,6 +98,7 @@ let
isPy2 = true; isPy2 = true;
isPy26 = true; isPy26 = true;
buildEnv = callPackage ../wrapper.nix { python = self; }; buildEnv = callPackage ../wrapper.nix { python = self; };
withPackages = import ../with-packages.nix { inherit buildEnv; pythonPackages = python26Packages; };
libPrefix = "python${majorVersion}"; libPrefix = "python${majorVersion}";
executable = libPrefix; executable = libPrefix;
sitePackages = "lib/${libPrefix}/site-packages"; sitePackages = "lib/${libPrefix}/site-packages";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, self, callPackage { stdenv, fetchurl, self, callPackage, python27Packages
, bzip2, openssl, gettext , bzip2, openssl, gettext
, includeModules ? false , includeModules ? false
@ -151,6 +151,7 @@ let
isPy2 = true; isPy2 = true;
isPy27 = true; isPy27 = true;
buildEnv = callPackage ../wrapper.nix { python = self; }; buildEnv = callPackage ../wrapper.nix { python = self; };
withPackages = import ../with-packages.nix { inherit buildEnv; pythonPackages = python27Packages; };
libPrefix = "python${majorVersion}"; libPrefix = "python${majorVersion}";
executable = libPrefix; executable = libPrefix;
sitePackages = "lib/${libPrefix}/site-packages"; sitePackages = "lib/${libPrefix}/site-packages";

View File

@ -12,6 +12,7 @@
, zlib , zlib
, callPackage , callPackage
, self , self
, python33Packages
}: }:
assert readline != null -> ncurses != null; assert readline != null -> ncurses != null;
@ -81,6 +82,7 @@ stdenv.mkDerivation {
libPrefix = "python${majorVersion}"; libPrefix = "python${majorVersion}";
executable = "python3.3m"; executable = "python3.3m";
buildEnv = callPackage ../wrapper.nix { python = self; }; buildEnv = callPackage ../wrapper.nix { python = self; };
withPackages = import ../with-packages.nix { inherit buildEnv; pythonPackages = python33Packages; };
isPy3 = true; isPy3 = true;
isPy33 = true; isPy33 = true;
is_py3k = true; # deprecated is_py3k = true; # deprecated

View File

@ -12,6 +12,7 @@
, zlib , zlib
, callPackage , callPackage
, self , self
, python34Packages
, CF, configd , CF, configd
}: }:
@ -104,6 +105,7 @@ stdenv.mkDerivation {
libPrefix = "python${majorVersion}"; libPrefix = "python${majorVersion}";
executable = "python3.4m"; executable = "python3.4m";
buildEnv = callPackage ../wrapper.nix { python = self; }; buildEnv = callPackage ../wrapper.nix { python = self; };
withPackages = import ../with-packages.nix { inherit buildEnv; pythonPackages = python34Packages; };
isPy3 = true; isPy3 = true;
isPy34 = true; isPy34 = true;
is_py3k = true; # deprecated is_py3k = true; # deprecated

View File

@ -12,6 +12,7 @@
, zlib , zlib
, callPackage , callPackage
, self , self
, python35Packages
, CF, configd , CF, configd
}: }:
@ -104,6 +105,7 @@ stdenv.mkDerivation {
libPrefix = "python${majorVersion}"; libPrefix = "python${majorVersion}";
executable = "python${majorVersion}m"; executable = "python${majorVersion}m";
buildEnv = callPackage ../wrapper.nix { python = self; }; buildEnv = callPackage ../wrapper.nix { python = self; };
withPackages = import ../with-packages.nix { inherit buildEnv; pythonPackages = python35Packages; };
isPy3 = true; isPy3 = true;
isPy35 = true; isPy35 = true;
is_py3k = true; # deprecated is_py3k = true; # deprecated

View File

@ -0,0 +1,3 @@
{ buildEnv, pythonPackages }:
f: let packages = f pythonPackages; in buildEnv.override { extraLibs = packages; }