git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #19594 from FRidh/tkinter

Python: no separate output for tkinter but build interpreter twice

commit1e916de64070b59fa30c288df43ff59b380559d1 authorDaniel Peebles <copumpkin@users.noreply.github.com> dateSun 16 Oct 2016, 19:28 (10 years ago) parent80433e7107c035
8 files changed+18−60
doc/languages-frameworks/python.md+1−1 pkgs/development/interpreters/python/cpython/2.7/default.nix+1−9 pkgs/development/interpreters/python/cpython/3.3/default.nix+1−7 pkgs/development/interpreters/python/cpython/3.4/default.nix+1−7 pkgs/development/interpreters/python/cpython/3.5/default.nix+1−8 pkgs/development/interpreters/python/cpython/3.6/default.nix+1−9 pkgs/top-level/all-packages.nix+1−12 pkgs/top-level/python-packages.nix+11−7
doc/languages-frameworks/python.md+1−1
@@ -422,7 +422,7 @@ exists.
422422
423423#### Missing `tkinter` module standard library
424424
425−To reduce closure size the `Tkinter`/`tkinter` is put in a separate output. The `tkinter` is available as `python35Packages.tkinter`.
425+To reduce closure size the `Tkinter`/`tkinter` is available as a separate package, `pythonPackages.tkinter`.
426426
427427#### Attributes on interpreters packages
428428
pkgs/development/interpreters/python/cpython/2.7/default.nix+1−9
@@ -6,7 +6,7 @@
66, openssl
77, readline
88, sqlite
9−, tcl ? null, tk ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? !stdenv.isCygwin
9+, tcl ? null, tk ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? false
1010, zlib
1111, callPackage
1212, self
@@ -170,14 +170,6 @@ in stdenv.mkDerivation {
170170 rm "$out"/lib/python*/plat-*/regen # refers to glibc.dev
171171 '';
172172
173− postFixup = optionalString x11Support ''
174− # tkinter goes in a separate output
175− mkdir -p $tkinter/${sitePackages}
176− mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/
177− '';
178−
179− outputs = ["out"] ++ optional x11Support "tkinter";
180−
181173 passthru = rec {
182174 inherit libPrefix sitePackages x11Support;
183175 executable = libPrefix;
pkgs/development/interpreters/python/cpython/3.3/default.nix+1−7
@@ -6,7 +6,7 @@
66, openssl
77, readline
88, sqlite
9−, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin
9+, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? false
1010, zlib
1111, callPackage
1212, self
@@ -92,14 +92,8 @@ in stdenv.mkDerivation {
9292 # FIXME: should regenerate this.
9393 rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython*
9494
95− '' + optionalString x11Support ''
96− # tkinter goes in a separate output
97− mkdir -p $tkinter/${sitePackages}
98− mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/
9995 '';
10096
101− outputs = ["out"] ++ optional x11Support "tkinter";
102−
10397 passthru = rec {
10498 inherit libPrefix sitePackages x11Support;
10599 executable = "${libPrefix}m";
pkgs/development/interpreters/python/cpython/3.4/default.nix+1−7
@@ -6,7 +6,7 @@
66, openssl
77, readline
88, sqlite
9−, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin
9+, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? false
1010, zlib
1111, callPackage
1212, self
@@ -101,14 +101,8 @@ in stdenv.mkDerivation {
101101 # FIXME: should regenerate this.
102102 rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython*
103103
104− '' + optionalString x11Support ''
105− # tkinter goes in a separate output
106− mkdir -p $tkinter/${sitePackages}
107− mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/
108104 '';
109105
110− outputs = ["out"] ++ optional x11Support "tkinter";
111−
112106 passthru = rec {
113107 inherit libPrefix sitePackages x11Support;
114108 executable = "${libPrefix}m";
pkgs/development/interpreters/python/cpython/3.5/default.nix+1−8
@@ -6,7 +6,7 @@
66, openssl
77, readline
88, sqlite
9−, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin
9+, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? false
1010, zlib
1111, callPackage
1212, self
@@ -100,15 +100,8 @@ in stdenv.mkDerivation {
100100
101101 # FIXME: should regenerate this.
102102 rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython*
103−
104− '' + optionalString x11Support ''
105− # tkinter goes in a separate output
106− mkdir -p $tkinter/${sitePackages}
107− mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/
108103 '';
109104
110− outputs = ["out"] ++ optional x11Support "tkinter";
111−
112105 passthru = rec {
113106 inherit libPrefix sitePackages x11Support;
114107 executable = "${libPrefix}m";
pkgs/development/interpreters/python/cpython/3.6/default.nix+1−9
@@ -7,7 +7,7 @@
77, openssl
88, readline
99, sqlite
10−, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin
10+, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? false
1111, zlib
1212, callPackage
1313, self
@@ -91,14 +91,6 @@ in stdenv.mkDerivation {
9191 echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py
9292 '';
9393
94− postFixup = optionalString x11Support ''
95− # tkinter goes in a separate output
96− mkdir -p $tkinter/${sitePackages}
97− mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/
98− '';
99−
100− outputs = ["out"] ++ optional x11Support "tkinter";
101−
10294 passthru = rec {
10395 inherit libPrefix sitePackages x11Support;
10496 executable = "${libPrefix}m";
pkgs/top-level/all-packages.nix+1−12
@@ -1663,7 +1663,6 @@ in
16631663
16641664 fontforge = lowPrio (callPackage ../tools/misc/fontforge {
16651665 inherit (darwin.apple_sdk.frameworks) Carbon Cocoa;
1666− python = pythonSmall;
16671666 });
16681667 fontforge-gtk = callPackage ../tools/misc/fontforge {
16691668 withGTK = true;
@@ -5494,11 +5493,6 @@ in
54945493 python2 = python27;
54955494 python3 = python35;
54965495
5497− # Python uses multiple outputs, and by default `python` is without X11/tkinter.
5498− # This package only exists to prevent an infinite recursion and should only be used
5499− # for packages Python itself depends on.
5500− pythonSmall = python.override {x11Support = false;};
5501−
55025496 # pythonPackages further below, but assigned here because they need to be in sync
55035497 pythonPackages = python2Packages;
55045498 python2Packages = python27Packages;
@@ -7144,7 +7138,6 @@ in
71447138 gtkmathview = callPackage ../development/libraries/gtkmathview { };
71457139
71467140 glib = callPackage ../development/libraries/glib {
7147− python = pythonSmall;
71487141 };
71497142 glib-tested = glib.override { # checked version separate to break cycles
71507143 doCheck = true;
@@ -8269,7 +8262,6 @@ in
82698262 libxmi = callPackage ../development/libraries/libxmi { };
82708263
82718264 libxml2 = callPackage ../development/libraries/libxml2 {
8272− python = pythonSmall;
82738265 };
82748266 libxml2Python = pkgs.buildEnv { # slightly hacky
82758267 name = "libxml2+py-${self.libxml2.version}";
@@ -10364,7 +10356,6 @@ in
1036410356 inherit (darwin) apple_sdk cf-private libobjc;
1036510357 bootstrap_cmds = if stdenv.isDarwin then darwin.bootstrap_cmds else null;
1036610358 mesa = mesa_noglu;
10367− python = pythonSmall;
1036810359 udev = if stdenv.isLinux then udev else null;
1036910360 libdrm = if stdenv.isLinux then libdrm else null;
1037010361 fglrxCompat = config.xorg.fglrxCompat or false; # `config` because we have no `xorg.override`
@@ -11516,9 +11507,7 @@ in
1151611507
1151711508 bgnet = callPackage ../data/documentation/bgnet { };
1151811509
11519− cacert = callPackage ../data/misc/cacert {
11520− python = pythonSmall;
11521− };
11510+ cacert = callPackage ../data/misc/cacert { };
1152211511
1152311512 caladea = callPackage ../data/fonts/caladea {};
1152411513
pkgs/top-level/python-packages.nix+11−7
@@ -24675,20 +24675,24 @@ in {
2467524675 };
2467624676
2467724677 # Tkinter/tkinter is part of the Python standard library.
24678− # To reduce closure size its put in a separate output, `python.tkinter`.
24679− # This alias was added to make this output work like any other Python package.
24680− tkinter = mkPythonDerivation rec {
24678+ # The Python interpreters in Nixpkgs come without tkinter by default.
24679+ # To make the module available, we make it available as any other
24680+ # Python package.
24681+ tkinter = let
24682+ py = python.override{x11Support=true;};
24683+ in mkPythonDerivation rec {
2468124684 name = "tkinter-${python.version}";
24682− src = python.tkinter;
24685+ src = py;
2468324686
2468424687 disabled = isPy26 || isPyPy;
2468524688
2468624689 installPhase = ''
24687− mkdir -p $out
24688− cp -R ${python.tkinter}/* $out
24690+ mkdir -p $out/${py.sitePackages}
24691+ ls -Al lib/${py.libPrefix}/lib-dynload/ | grep tkinter
24692+ mv lib/${py.libPrefix}/lib-dynload/_tkinter* $out/${py.sitePackages}/
2468924693 '';
2469024694
24691− inherit (python) meta;
24695+ inherit (py) meta;
2469224696 };
2469324697
2469424698 tlslite = buildPythonPackage rec {