* Python 2.7: get rid of most dependencies.

svn path=/nixpkgs/branches/modular-python/; revision=25385
This commit is contained in:
Eelco Dolstra 2011-01-04 14:47:36 +00:00
parent c1eb464f3c
commit b7b1fc322a
2 changed files with 29 additions and 64 deletions

@ -1,22 +1,10 @@
{ stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2
, gdbmSupport ? true, gdbm ? null
, sqlite ? null
, db4 ? null
, readline ? null
, openssl ? null
, tk ? null
, tcl ? null
, libX11 ? null
, xproto ? null
, arch ? null
, sw_vers ? null
, ncurses ? null
, darwinArchUtility ? null, darwinSwVersUtility ? null
}:
assert zlibSupport -> zlib != null;
assert gdbmSupport -> gdbm != null;
assert stdenv.isDarwin -> arch != null;
assert stdenv.isDarwin -> sw_vers != null;
assert stdenv.isDarwin -> darwinArchUtility != null;
assert stdenv.isDarwin -> darwinSwVersUtility != null;
with stdenv.lib;
@ -27,25 +15,13 @@ let
buildInputs =
optional (stdenv ? gcc && stdenv.gcc.libc != null) stdenv.gcc.libc ++
[bzip2]
[ bzip2 ]
++ optional zlibSupport zlib
++ optional gdbmSupport gdbm
++ optional (sqlite != null) sqlite
++ optional (db4 != null) db4
++ optional (readline != null) readline
++ optional (openssl != null) openssl
++ optional (tk != null) tk
++ optional (tcl != null) tcl
++ optional (libX11 != null) libX11
++ optional (xproto != null) xproto
++ optional (arch != null) arch
++ optional (sw_vers != null) sw_vers
++ optional (ncurses != null) ncurses
;
++ optionals stdenv.isDarwin [ darwinArchUtility darwinSwVersUtility ];
in
stdenv.mkDerivation ( {
stdenv.mkDerivation {
name = "python-${version}";
inherit majorVersion version;
@ -54,38 +30,37 @@ stdenv.mkDerivation ( {
sha256 = "14i2c7yqa7ljmx2i2bb827n61q33zn23ax96czi8rbkyyny8gqw0";
};
patches = [
# Look in C_INCLUDE_PATH and LIBRARY_PATH for stuff.
./search-path.patch
];
patches =
[ # Look in C_INCLUDE_PATH and LIBRARY_PATH for stuff.
./search-path.patch
];
inherit buildInputs;
C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs);
LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs);
configureFlags = "--enable-shared --with-threads --enable-unicode --with-wctype-functions";
preConfigure = ''
# Purity.
for i in /usr /sw /opt /pkg; do
substituteInPlace ./setup.py --replace $i /no-such-path
done
'' + (if readline != null then ''
export NIX_LDFLAGS="$NIX_LDFLAGS -lncurses"
'' else "");
preConfigure =
''
# Purity.
for i in /usr /sw /opt /pkg; do
substituteInPlace ./setup.py --replace $i /no-such-path
done
'';
NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2";
setupHook = ./setup-hook.sh;
postInstall = ''
rm -rf "$out/lib/python${majorVersion}/test"
'';
postInstall =
''
rm -rf "$out/lib/python${majorVersion}/test"
'';
passthru = {
inherit zlibSupport;
sqliteSupport = sqlite != null;
db4Support = db4 != null;
readlineSupport = readline != null;
opensslSupport = openssl != null;
tkSupport = (tk != null) && (tcl != null);
libPrefix = "python${majorVersion}";
};
@ -107,4 +82,4 @@ stdenv.mkDerivation ( {
platforms = stdenv.lib.platforms.all;
maintainers = [ stdenv.lib.maintainers.simons ];
};
} // (if stdenv.isDarwin then { NIX_CFLAGS_COMPILE = "-msse2" ; patches = [./search-path.patch]; } else {} ) )
}

@ -2267,7 +2267,6 @@ let
python = if getConfig ["python" "full"] false then pythonFull else pythonBase;
python26 = if getConfig ["python" "full"] false then python26Full else python26Base;
python27 = if getConfig ["python" "full"] false then python27Full else python27Base;
pythonBase = python26Base;
pythonFull = python26Full;
@ -2294,19 +2293,10 @@ let
ncurses = if getConfig ["python" "curses"] true then ncurses else null;
});
python27Base = lowPrio (makeOverridable (import ../development/interpreters/python/2.7) {
inherit (pkgs) fetchurl stdenv zlib bzip2 gdbm;
arch = if stdenv.isDarwin then darwinArchUtility else null;
sw_vers = if stdenv.isDarwin then darwinSwVersUtility else null;
});
python27 = callPackage ../development/interpreters/python/2.7 { };
python27Full = lowPrio (python27Base.override {
inherit (pkgs) db4 sqlite readline openssl tcl tk ncurses;
inherit (pkgs.xlibs) libX11 xproto;
});
pythonModules = callPackage ../development/interpreters/python/2.7/modules.nix {
python = python27Base;
python27Modules = callPackage ../development/interpreters/python/2.7/modules.nix {
python = python27;
};
python31Base = lowPrio (makeOverridable (import ../development/interpreters/python/3.1) {