* 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

View File

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

View File

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