Python: further unify expressions interpreters

This commit is contained in:
Frederik Rietdijk 2016-10-14 15:06:01 +02:00
parent 061758490f
commit 80433e7030
6 changed files with 75 additions and 124 deletions

View File

@ -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}";
};

View File

@ -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; };

View File

@ -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; };

View File

@ -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}";
};

View File

@ -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; };

View File

@ -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;