2011-02-02 12:17:06 +01:00
|
|
|
{ stdenv, fetchurl
|
|
|
|
, zlib
|
|
|
|
, bzip2
|
|
|
|
, gdbm
|
|
|
|
, sqlite
|
|
|
|
, db4
|
|
|
|
, ncurses
|
|
|
|
, readline
|
|
|
|
, openssl
|
|
|
|
, tcl, tk
|
|
|
|
, libX11, xproto
|
|
|
|
, arch ? null, sw_vers ? null
|
2010-04-17 20:28:25 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert stdenv.isDarwin -> arch != null;
|
|
|
|
assert stdenv.isDarwin -> sw_vers != null;
|
2011-02-02 12:17:06 +01:00
|
|
|
assert readline != null -> ncurses != null;
|
2010-04-17 20:28:25 +02:00
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
majorVersion = "3.1";
|
2011-02-02 12:16:41 +01:00
|
|
|
version = "${majorVersion}.3";
|
2010-04-17 20:28:25 +02:00
|
|
|
|
2011-02-02 12:17:06 +01:00
|
|
|
buildInputs = filter (p: p != null) [
|
|
|
|
zlib bzip2 gdbm sqlite db4 readline ncurses openssl tcl tk libX11 xproto arch sw_vers
|
|
|
|
];
|
2010-04-17 20:28:25 +02:00
|
|
|
in
|
2011-02-02 12:17:06 +01:00
|
|
|
stdenv.mkDerivation {
|
2010-04-23 12:42:29 +02:00
|
|
|
name = "python3-${version}";
|
2010-08-16 19:03:35 +02:00
|
|
|
inherit majorVersion version;
|
2010-04-17 20:28:25 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.bz2";
|
2011-02-02 12:16:41 +01:00
|
|
|
sha256 = "1jsqapgwrcqcaskyi2qdn1xj7l8x5340a137hdfshk5ya4dg9xkp";
|
2010-04-17 20:28:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
inherit buildInputs;
|
2011-02-02 12:17:06 +01:00
|
|
|
patches = [ ./search-path.patch ];
|
|
|
|
|
2010-04-17 20:28:25 +02:00
|
|
|
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 = ''
|
2011-02-02 12:17:06 +01:00
|
|
|
for i in /usr /sw /opt /pkg; do # improve purity
|
2010-04-17 20:28:25 +02:00
|
|
|
substituteInPlace ./setup.py --replace $i /no-such-path
|
|
|
|
done
|
2011-02-02 12:17:06 +01:00
|
|
|
${optionalString (ncurses != null) ''export NIX_LDFLAGS="$NIX_LDFLAGS -lncurses"''}
|
|
|
|
${optionalString stdenv.isDarwin ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"''}
|
|
|
|
'';
|
2010-04-17 20:28:25 +02:00
|
|
|
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
rm -rf "$out/lib/python${majorVersion}/test"
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
2011-02-02 12:17:06 +01:00
|
|
|
zlibSupport = zlib != null;
|
2010-04-17 20:28:25 +02:00
|
|
|
sqliteSupport = sqlite != null;
|
|
|
|
db4Support = db4 != null;
|
|
|
|
readlineSupport = readline != null;
|
|
|
|
opensslSupport = openssl != null;
|
|
|
|
tkSupport = (tk != null) && (tcl != null);
|
|
|
|
libPrefix = "python${majorVersion}";
|
|
|
|
};
|
|
|
|
|
2011-02-02 12:16:53 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2010-04-17 20:28:25 +02:00
|
|
|
meta = {
|
2011-02-02 12:16:49 +01:00
|
|
|
homepage = "http://python.org";
|
|
|
|
description = "a high-level dynamically-typed programming language";
|
|
|
|
longDescription = ''
|
|
|
|
Python is a remarkably powerful dynamic programming language that
|
|
|
|
is used in a wide variety of application domains. Some of its key
|
|
|
|
distinguishing features include: clear, readable syntax; strong
|
|
|
|
introspection capabilities; intuitive object orientation; natural
|
|
|
|
expression of procedural code; full modularity, supporting
|
|
|
|
hierarchical packages; exception-based error handling; and very
|
|
|
|
high level dynamic data types.
|
|
|
|
'';
|
|
|
|
license = "GPLv2";
|
2010-04-17 20:28:25 +02:00
|
|
|
platforms = stdenv.lib.platforms.all;
|
2011-02-02 12:16:49 +01:00
|
|
|
maintainers = [ stdenv.lib.maintainers.simons ];
|
2010-04-17 20:28:25 +02:00
|
|
|
};
|
2011-02-02 12:17:06 +01:00
|
|
|
}
|