git.iko.soy/typeable/nixpkgs
on master help sign in
Python: further unify expressions interpreters
commit80433e70302be5498f07996d04bacb4cecfc6a7b authorFrederik Rietdijk <fridh@fridh.nl> dateFri 14 Oct 2016, 15:06 (10 years ago) parent0617584
6 files changed+76−125
pkgs/development/interpreters/python/cpython/2.7/default.nix+23−19 pkgs/development/interpreters/python/cpython/3.3/default.nix+13−16 pkgs/development/interpreters/python/cpython/3.4/default.nix+13−30 pkgs/development/interpreters/python/cpython/3.5/default.nix+13−28 pkgs/development/interpreters/python/cpython/3.6/default.nix+13−32 pkgs/top-level/all-packages.nix+1
pkgs/development/interpreters/python/cpython/2.7/default.nix+23−19
@@ -1,15 +1,23 @@
1−{ stdenv, fetchurl, fetchpatch, self, callPackage, python27Packages
2−, bzip2, openssl, gettext
3−, db, gdbm, ncurses, sqlite, readline
4−
1+{ stdenv, fetchurl
2+, bzip2
3+, gdbm
4+, fetchpatch
5+, ncurses
6+, openssl
7+, readline
8+, sqlite
59, tcl ? null, tk ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? !stdenv.isCygwin
6−, zlib ? null, zlibSupport ? true
7−, expat, libffi
8−
10+, zlib
11+, callPackage
12+, self
13+, python27Packages
14+, gettext
15+, db
16+, expat
17+, libffi
918, CF, configd
1019}:
1120
12−assert zlibSupport -> zlib != null;
1321assert x11Support -> tcl != null
1422 && tk != null
1523 && xlibsWrapper != null
@@ -109,14 +117,11 @@ let
109117
110118 buildInputs =
111119 optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
112− [ bzip2 openssl ]
120+ [ bzip2 openssl zlib ]
113121 ++ optionals stdenv.isCygwin [ expat libffi ]
114122 ++ [ db gdbm ncurses sqlite readline ]
115123 ++ optionals x11Support [ tcl tk xlibsWrapper libX11 ]
116− ++ optional zlibSupport zlib
117− ++ optional stdenv.isDarwin CF;
118−
119− propagatedBuildInputs = optional stdenv.isDarwin configd;
124+ ++ optionals stdenv.isDarwin [ CF configd ];
120125
121126 mkPaths = paths: {
122127 C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths;
@@ -130,7 +135,7 @@ in stdenv.mkDerivation {
130135 name = "python-${version}";
131136 pythonVersion = majorVersion;
132137
133− inherit majorVersion version src patches buildInputs propagatedBuildInputs
138+ inherit majorVersion version src patches buildInputs
134139 preConfigure configureFlags;
135140
136141 LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
@@ -174,13 +179,12 @@ in stdenv.mkDerivation {
174179 outputs = ["out"] ++ optional x11Support "tkinter";
175180
176181 passthru = rec {
177− inherit libPrefix sitePackages;
178− inherit zlibSupport;
179− isPy2 = true;
180− isPy27 = true;
182+ inherit libPrefix sitePackages x11Support;
183+ executable = libPrefix;
181184 buildEnv = callPackage ../../wrapper.nix { python = self; };
182185 withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python27Packages; };
183− executable = libPrefix;
186+ isPy2 = true;
187+ isPy27 = true;
184188 interpreter = "${self}/bin/${executable}";
185189 };
186190
pkgs/development/interpreters/python/cpython/3.3/default.nix+13−16
@@ -1,21 +1,23 @@
11{ stdenv, fetchurl
22, bzip2
3−, db
43, gdbm
5−, libX11, xproto
64, lzma
75, ncurses
86, openssl
97, readline
108, sqlite
11−, tcl, tk
9+, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin
1210, zlib
1311, callPackage
1412, self
1513, python33Packages
14+, CF, configd
1615}:
1716
18−assert readline != null -> ncurses != null;
17+assert x11Support -> tcl != null
18+ && tk != null
19+ && xproto != null
20+ && libX11 != null;
1921
2022with stdenv.lib;
2123
@@ -29,11 +31,11 @@ let
2931 sitePackages = "lib/${libPrefix}/site-packages";
3032
3133 buildInputs = filter (p: p != null) [
32− zlib bzip2 lzma gdbm sqlite db readline ncurses openssl tcl tk libX11 xproto
33− ];
34+ zlib bzip2 lzma gdbm sqlite readline ncurses openssl ]
35+ ++ optionals x11Support [ tcl tk libX11 xproto ]
36+ ++ optionals stdenv.isDarwin [ CF configd ];
3437
35−in
36−stdenv.mkDerivation {
38+in stdenv.mkDerivation {
3739 name = "python3-${version}";
3840 pythonVersion = majorVersion;
3941 inherit majorVersion version;
@@ -90,21 +92,16 @@ stdenv.mkDerivation {
9092 # FIXME: should regenerate this.
9193 rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython*
9294
95+ '' + optionalString x11Support ''
9396 # tkinter goes in a separate output
9497 mkdir -p $tkinter/${sitePackages}
9598 mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/
9699 '';
97100
98− outputs = ["out" "tkinter"];
101+ outputs = ["out"] ++ optional x11Support "tkinter";
99102
100103 passthru = rec {
101− inherit libPrefix sitePackages;
102− zlibSupport = zlib != null;
103− sqliteSupport = sqlite != null;
104− dbSupport = db != null;
105− readlineSupport = readline != null;
106− opensslSupport = openssl != null;
107− tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null);
104+ inherit libPrefix sitePackages x11Support;
108105 executable = "${libPrefix}m";
109106 buildEnv = callPackage ../../wrapper.nix { python = self; };
110107 withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python33Packages; };
pkgs/development/interpreters/python/cpython/3.4/default.nix+13−30
@@ -1,23 +1,23 @@
11{ stdenv, fetchurl
22, bzip2
3−, db
43, gdbm
5−, libX11, xproto
64, lzma
75, ncurses
86, openssl
97, readline
108, sqlite
11−, tcl, tk
9+, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin
1210, zlib
1311, callPackage
1412, self
1513, python34Packages
16−
1714, CF, configd
1815}:
1916
20−assert readline != null -> ncurses != null;
17+assert x11Support -> tcl != null
18+ && tk != null
19+ && xproto != null
20+ && libX11 != null;
2121
2222with stdenv.lib;
2323
@@ -31,23 +31,11 @@ let
3131 sitePackages = "lib/${libPrefix}/site-packages";
3232
3333 buildInputs = filter (p: p != null) [
34− zlib
35− bzip2
36− lzma
37− gdbm
38− sqlite
39− db
40− readline
41− ncurses
42− openssl
43− tcl
44− tk
45− libX11
46− xproto
47− ] ++ optionals stdenv.isDarwin [ CF configd ];
48−
49−in
50−stdenv.mkDerivation {
34+ zlib bzip2 lzma gdbm sqlite readline ncurses openssl ]
35+ ++ optionals x11Support [ tcl tk libX11 xproto ]
36+ ++ optionals stdenv.isDarwin [ CF configd ];
37+
38+in stdenv.mkDerivation {
5139 name = "python3-${version}";
5240 pythonVersion = majorVersion;
5341 inherit majorVersion version;
@@ -113,21 +101,16 @@ stdenv.mkDerivation {
113101 # FIXME: should regenerate this.
114102 rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython*
115103
104+ '' + optionalString x11Support ''
116105 # tkinter goes in a separate output
117106 mkdir -p $tkinter/${sitePackages}
118107 mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/
119108 '';
120109
121− outputs = ["out" "tkinter"];
110+ outputs = ["out"] ++ optional x11Support "tkinter";
122111
123112 passthru = rec {
124− inherit libPrefix sitePackages;
125− zlibSupport = zlib != null;
126− sqliteSupport = sqlite != null;
127− dbSupport = db != null;
128− readlineSupport = readline != null;
129− opensslSupport = openssl != null;
130− tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null);
113+ inherit libPrefix sitePackages x11Support;
131114 executable = "${libPrefix}m";
132115 buildEnv = callPackage ../../wrapper.nix { python = self; };
133116 withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python34Packages; };
pkgs/development/interpreters/python/cpython/3.5/default.nix+13−28
@@ -1,22 +1,23 @@
11{ stdenv, fetchurl
22, bzip2
33, gdbm
4−, libX11, xproto
54, lzma
65, ncurses
76, openssl
87, readline
98, sqlite
10−, tcl, tk
9+, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin
1110, zlib
1211, callPackage
1312, self
1413, python35Packages
15−
1614, CF, configd
1715}:
1816
19−assert readline != null -> ncurses != null;
17+assert x11Support -> tcl != null
18+ && tk != null
19+ && xproto != null
20+ && libX11 != null;
2021
2122with stdenv.lib;
2223
@@ -30,21 +31,11 @@ let
3031 sitePackages = "lib/${libPrefix}/site-packages";
3132
3233 buildInputs = filter (p: p != null) [
33− zlib
34− bzip2
35− lzma
36− gdbm
37− sqlite
38− readline
39− ncurses
40− openssl
41− tcl
42− tk
43− libX11
44− xproto
45− ] ++ optionals stdenv.isDarwin [ CF configd ];
46−in
47−stdenv.mkDerivation {
34+ zlib bzip2 lzma gdbm sqlite readline ncurses openssl ]
35+ ++ optionals x11Support [ tcl tk libX11 xproto ]
36+ ++ optionals stdenv.isDarwin [ CF configd ];
37+
38+in stdenv.mkDerivation {
4839 name = "python3-${version}";
4940 pythonVersion = majorVersion;
5041 inherit majorVersion version;
@@ -110,27 +101,21 @@ stdenv.mkDerivation {
110101 # FIXME: should regenerate this.
111102 rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython*
112103
104+ '' + optionalString x11Support ''
113105 # tkinter goes in a separate output
114106 mkdir -p $tkinter/${sitePackages}
115107 mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/
116108 '';
117109
118− outputs = ["out" "tkinter"];
110+ outputs = ["out"] ++ optional x11Support "tkinter";
119111
120112 passthru = rec {
121− inherit libPrefix sitePackages;
122− zlibSupport = zlib != null;
123− sqliteSupport = sqlite != null;
124− dbSupport = false;
125− readlineSupport = readline != null;
126− opensslSupport = openssl != null;
127− tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null);
113+ inherit libPrefix sitePackages x11Support;
128114 executable = "${libPrefix}m";
129115 buildEnv = callPackage ../../wrapper.nix { python = self; };
130116 withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python35Packages; };
131117 isPy3 = true;
132118 isPy35 = true;
133− is_py3k = true; # deprecated
134119 interpreter = "${self}/bin/${executable}";
135120 };
136121
pkgs/development/interpreters/python/cpython/3.6/default.nix+13−32
@@ -1,25 +1,24 @@
11{ stdenv, fetchurl
22, glibc
33, bzip2
4−, db
54, gdbm
6−, libX11, xproto
75, lzma
86, ncurses
97, openssl
108, readline
119, sqlite
12−, tcl, tk
10+, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin
1311, zlib
1412, callPackage
1513, self
1614, python36Packages
17−
1815, CF, configd
1916}:
2017
21−assert readline != null -> ncurses != null;
22−
18+assert x11Support -> tcl != null
19+ && tk != null
20+ && xproto != null
21+ && libX11 != null;
2322with stdenv.lib;
2423
2524let
@@ -32,23 +31,11 @@ let
3231 sitePackages = "lib/${libPrefix}/site-packages";
3332
3433 buildInputs = filter (p: p != null) [
35− glibc
36− zlib
37− bzip2
38− lzma
39− gdbm
40− sqlite
41− db
42− readline
43− ncurses
44− openssl
45− tcl
46− tk
47− libX11
48− xproto
49− ] ++ optionals stdenv.isDarwin [ CF configd ];
50−in
51−stdenv.mkDerivation {
34+ zlib bzip2 lzma gdbm sqlite readline ncurses openssl ]
35+ ++ optionals x11Support [ tcl tk libX11 xproto ]
36+ ++ optionals stdenv.isDarwin [ CF configd ];
37+
38+in stdenv.mkDerivation {
5239 name = "python3-${version}";
5340 pythonVersion = majorVersion;
5441 inherit majorVersion version;
@@ -104,22 +91,16 @@ stdenv.mkDerivation {
10491 echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py
10592 '';
10693
107− postFixup = ''
94+ postFixup = optionalString x11Support ''
10895 # tkinter goes in a separate output
10996 mkdir -p $tkinter/${sitePackages}
11097 mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/
11198 '';
11299
113− outputs = ["out" "tkinter"];
100+ outputs = ["out"] ++ optional x11Support "tkinter";
114101
115102 passthru = rec {
116− inherit libPrefix sitePackages;
117− zlibSupport = zlib != null;
118− sqliteSupport = sqlite != null;
119− dbSupport = db != null;
120− readlineSupport = readline != null;
121− opensslSupport = openssl != null;
122− tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null);
103+ inherit libPrefix sitePackages x11Support;
123104 executable = "${libPrefix}m";
124105 buildEnv = callPackage ../../wrapper.nix { python = self; };
125106 withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python36Packages; };
pkgs/top-level/all-packages.nix+1
@@ -5514,6 +5514,7 @@ in
55145514 };
55155515 python33 = callPackage ../development/interpreters/python/cpython/3.3 {
55165516 self = python33;
5517+ inherit (darwin) CF configd;
55175518 };
55185519 python34 = hiPrio (callPackage ../development/interpreters/python/cpython/3.4 {
55195520 inherit (darwin) CF configd;