From 80433e70302be5498f07996d04bacb4cecfc6a7b Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Fri, 14 Oct 2016 15:06:01 +0200 Subject: [PATCH] Python: further unify expressions interpreters --- .../python/cpython/2.7/default.nix | 42 +++++++++-------- .../python/cpython/3.3/default.nix | 29 ++++++------ .../python/cpython/3.4/default.nix | 41 +++++------------ .../python/cpython/3.5/default.nix | 41 ++++++----------- .../python/cpython/3.6/default.nix | 45 ++++++------------- pkgs/top-level/all-packages.nix | 1 + 6 files changed, 75 insertions(+), 124 deletions(-) diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix index b9f69ec12d84..b1c64020fe9a 100644 --- a/pkgs/development/interpreters/python/cpython/2.7/default.nix +++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix @@ -1,15 +1,23 @@ -{ stdenv, fetchurl, fetchpatch, self, callPackage, python27Packages -, bzip2, openssl, gettext -, db, gdbm, ncurses, sqlite, readline - +{ stdenv, fetchurl +, bzip2 +, gdbm +, fetchpatch +, ncurses +, openssl +, readline +, sqlite , tcl ? null, tk ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? !stdenv.isCygwin -, zlib ? null, zlibSupport ? true -, expat, libffi - +, zlib +, callPackage +, self +, python27Packages +, gettext +, db +, expat +, libffi , CF, configd }: -assert zlibSupport -> zlib != null; assert x11Support -> tcl != null && tk != null && xlibsWrapper != null @@ -109,14 +117,11 @@ let buildInputs = optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++ - [ bzip2 openssl ] + [ bzip2 openssl zlib ] ++ optionals stdenv.isCygwin [ expat libffi ] ++ [ db gdbm ncurses sqlite readline ] ++ optionals x11Support [ tcl tk xlibsWrapper libX11 ] - ++ optional zlibSupport zlib - ++ optional stdenv.isDarwin CF; - - propagatedBuildInputs = optional stdenv.isDarwin configd; + ++ optionals stdenv.isDarwin [ CF configd ]; mkPaths = paths: { C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths; @@ -130,7 +135,7 @@ in stdenv.mkDerivation { name = "python-${version}"; pythonVersion = majorVersion; - inherit majorVersion version src patches buildInputs propagatedBuildInputs + inherit majorVersion version src patches buildInputs preConfigure configureFlags; LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s"; @@ -174,13 +179,12 @@ in stdenv.mkDerivation { outputs = ["out"] ++ optional x11Support "tkinter"; passthru = rec { - inherit libPrefix sitePackages; - inherit zlibSupport; - isPy2 = true; - isPy27 = true; + inherit libPrefix sitePackages x11Support; + executable = libPrefix; buildEnv = callPackage ../../wrapper.nix { python = self; }; withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python27Packages; }; - executable = libPrefix; + isPy2 = true; + isPy27 = true; interpreter = "${self}/bin/${executable}"; }; diff --git a/pkgs/development/interpreters/python/cpython/3.3/default.nix b/pkgs/development/interpreters/python/cpython/3.3/default.nix index 614ec555c734..478a3c96dd9a 100644 --- a/pkgs/development/interpreters/python/cpython/3.3/default.nix +++ b/pkgs/development/interpreters/python/cpython/3.3/default.nix @@ -1,21 +1,23 @@ { stdenv, fetchurl , bzip2 -, db , gdbm -, libX11, xproto , lzma , ncurses , openssl , readline , sqlite -, tcl, tk +, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin , zlib , callPackage , self , python33Packages +, CF, configd }: -assert readline != null -> ncurses != null; +assert x11Support -> tcl != null + && tk != null + && xproto != null + && libX11 != null; with stdenv.lib; @@ -29,11 +31,11 @@ let sitePackages = "lib/${libPrefix}/site-packages"; buildInputs = filter (p: p != null) [ - zlib bzip2 lzma gdbm sqlite db readline ncurses openssl tcl tk libX11 xproto - ]; + zlib bzip2 lzma gdbm sqlite readline ncurses openssl ] + ++ optionals x11Support [ tcl tk libX11 xproto ] + ++ optionals stdenv.isDarwin [ CF configd ]; -in -stdenv.mkDerivation { +in stdenv.mkDerivation { name = "python3-${version}"; pythonVersion = majorVersion; inherit majorVersion version; @@ -90,21 +92,16 @@ stdenv.mkDerivation { # FIXME: should regenerate this. rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython* + '' + optionalString x11Support '' # tkinter goes in a separate output mkdir -p $tkinter/${sitePackages} mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/ ''; - outputs = ["out" "tkinter"]; + outputs = ["out"] ++ optional x11Support "tkinter"; passthru = rec { - inherit libPrefix sitePackages; - zlibSupport = zlib != null; - sqliteSupport = sqlite != null; - dbSupport = db != null; - readlineSupport = readline != null; - opensslSupport = openssl != null; - tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null); + inherit libPrefix sitePackages x11Support; executable = "${libPrefix}m"; buildEnv = callPackage ../../wrapper.nix { python = self; }; withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python33Packages; }; diff --git a/pkgs/development/interpreters/python/cpython/3.4/default.nix b/pkgs/development/interpreters/python/cpython/3.4/default.nix index f25398558ac6..0e0dc4acfca6 100644 --- a/pkgs/development/interpreters/python/cpython/3.4/default.nix +++ b/pkgs/development/interpreters/python/cpython/3.4/default.nix @@ -1,23 +1,23 @@ { stdenv, fetchurl , bzip2 -, db , gdbm -, libX11, xproto , lzma , ncurses , openssl , readline , sqlite -, tcl, tk +, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin , zlib , callPackage , self , python34Packages - , CF, configd }: -assert readline != null -> ncurses != null; +assert x11Support -> tcl != null + && tk != null + && xproto != null + && libX11 != null; with stdenv.lib; @@ -31,23 +31,11 @@ let sitePackages = "lib/${libPrefix}/site-packages"; buildInputs = filter (p: p != null) [ - zlib - bzip2 - lzma - gdbm - sqlite - db - readline - ncurses - openssl - tcl - tk - libX11 - xproto - ] ++ optionals stdenv.isDarwin [ CF configd ]; + zlib bzip2 lzma gdbm sqlite readline ncurses openssl ] + ++ optionals x11Support [ tcl tk libX11 xproto ] + ++ optionals stdenv.isDarwin [ CF configd ]; -in -stdenv.mkDerivation { +in stdenv.mkDerivation { name = "python3-${version}"; pythonVersion = majorVersion; inherit majorVersion version; @@ -113,21 +101,16 @@ stdenv.mkDerivation { # FIXME: should regenerate this. rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython* + '' + optionalString x11Support '' # tkinter goes in a separate output mkdir -p $tkinter/${sitePackages} mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/ ''; - outputs = ["out" "tkinter"]; + outputs = ["out"] ++ optional x11Support "tkinter"; passthru = rec { - inherit libPrefix sitePackages; - zlibSupport = zlib != null; - sqliteSupport = sqlite != null; - dbSupport = db != null; - readlineSupport = readline != null; - opensslSupport = openssl != null; - tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null); + inherit libPrefix sitePackages x11Support; executable = "${libPrefix}m"; buildEnv = callPackage ../../wrapper.nix { python = self; }; withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python34Packages; }; diff --git a/pkgs/development/interpreters/python/cpython/3.5/default.nix b/pkgs/development/interpreters/python/cpython/3.5/default.nix index e1a2983d032a..b7839d9f4a13 100644 --- a/pkgs/development/interpreters/python/cpython/3.5/default.nix +++ b/pkgs/development/interpreters/python/cpython/3.5/default.nix @@ -1,22 +1,23 @@ { stdenv, fetchurl , bzip2 , gdbm -, libX11, xproto , lzma , ncurses , openssl , readline , sqlite -, tcl, tk +, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin , zlib , callPackage , self , python35Packages - , CF, configd }: -assert readline != null -> ncurses != null; +assert x11Support -> tcl != null + && tk != null + && xproto != null + && libX11 != null; with stdenv.lib; @@ -30,21 +31,11 @@ let sitePackages = "lib/${libPrefix}/site-packages"; buildInputs = filter (p: p != null) [ - zlib - bzip2 - lzma - gdbm - sqlite - readline - ncurses - openssl - tcl - tk - libX11 - xproto - ] ++ optionals stdenv.isDarwin [ CF configd ]; -in -stdenv.mkDerivation { + zlib bzip2 lzma gdbm sqlite readline ncurses openssl ] + ++ optionals x11Support [ tcl tk libX11 xproto ] + ++ optionals stdenv.isDarwin [ CF configd ]; + +in stdenv.mkDerivation { name = "python3-${version}"; pythonVersion = majorVersion; inherit majorVersion version; @@ -110,27 +101,21 @@ stdenv.mkDerivation { # FIXME: should regenerate this. rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython* + '' + optionalString x11Support '' # tkinter goes in a separate output mkdir -p $tkinter/${sitePackages} mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/ ''; - outputs = ["out" "tkinter"]; + outputs = ["out"] ++ optional x11Support "tkinter"; passthru = rec { - inherit libPrefix sitePackages; - zlibSupport = zlib != null; - sqliteSupport = sqlite != null; - dbSupport = false; - readlineSupport = readline != null; - opensslSupport = openssl != null; - tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null); + inherit libPrefix sitePackages x11Support; executable = "${libPrefix}m"; buildEnv = callPackage ../../wrapper.nix { python = self; }; withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python35Packages; }; isPy3 = true; isPy35 = true; - is_py3k = true; # deprecated interpreter = "${self}/bin/${executable}"; }; diff --git a/pkgs/development/interpreters/python/cpython/3.6/default.nix b/pkgs/development/interpreters/python/cpython/3.6/default.nix index 760567e09d6b..4c91aaf8978d 100644 --- a/pkgs/development/interpreters/python/cpython/3.6/default.nix +++ b/pkgs/development/interpreters/python/cpython/3.6/default.nix @@ -1,25 +1,24 @@ { stdenv, fetchurl , glibc , bzip2 -, db , gdbm -, libX11, xproto , lzma , ncurses , openssl , readline , sqlite -, tcl, tk +, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? !stdenv.isCygwin , zlib , callPackage , self , python36Packages - , CF, configd }: -assert readline != null -> ncurses != null; - +assert x11Support -> tcl != null + && tk != null + && xproto != null + && libX11 != null; with stdenv.lib; let @@ -32,23 +31,11 @@ let sitePackages = "lib/${libPrefix}/site-packages"; buildInputs = filter (p: p != null) [ - glibc - zlib - bzip2 - lzma - gdbm - sqlite - db - readline - ncurses - openssl - tcl - tk - libX11 - xproto - ] ++ optionals stdenv.isDarwin [ CF configd ]; -in -stdenv.mkDerivation { + zlib bzip2 lzma gdbm sqlite readline ncurses openssl ] + ++ optionals x11Support [ tcl tk libX11 xproto ] + ++ optionals stdenv.isDarwin [ CF configd ]; + +in stdenv.mkDerivation { name = "python3-${version}"; pythonVersion = majorVersion; inherit majorVersion version; @@ -104,22 +91,16 @@ stdenv.mkDerivation { echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py ''; - postFixup = '' + postFixup = optionalString x11Support '' # tkinter goes in a separate output mkdir -p $tkinter/${sitePackages} mv $out/lib/${libPrefix}/lib-dynload/_tkinter* $tkinter/${sitePackages}/ ''; - outputs = ["out" "tkinter"]; + outputs = ["out"] ++ optional x11Support "tkinter"; passthru = rec { - inherit libPrefix sitePackages; - zlibSupport = zlib != null; - sqliteSupport = sqlite != null; - dbSupport = db != null; - readlineSupport = readline != null; - opensslSupport = openssl != null; - tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null); + inherit libPrefix sitePackages x11Support; executable = "${libPrefix}m"; buildEnv = callPackage ../../wrapper.nix { python = self; }; withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python36Packages; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ca3413b27524..bc5620e06e39 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5514,6 +5514,7 @@ in }; python33 = callPackage ../development/interpreters/python/cpython/3.3 { self = python33; + inherit (darwin) CF configd; }; python34 = hiPrio (callPackage ../development/interpreters/python/cpython/3.4 { inherit (darwin) CF configd;