at 16.09-beta 3.6 kB view raw
1{ stdenv, fetchurl 2, bzip2 3, db 4, gdbm 5, libX11, xproto 6, lzma 7, ncurses 8, openssl 9, readline 10, sqlite 11, tcl, tk 12, zlib 13, callPackage 14, self 15, python33Packages 16}: 17 18assert readline != null -> ncurses != null; 19 20with stdenv.lib; 21 22let 23 majorVersion = "3.3"; 24 pythonVersion = majorVersion; 25 version = "${majorVersion}.6"; 26 27 buildInputs = filter (p: p != null) [ 28 zlib bzip2 lzma gdbm sqlite db readline ncurses openssl tcl tk libX11 xproto 29 ]; 30 31in 32stdenv.mkDerivation { 33 name = "python3-${version}"; 34 pythonVersion = majorVersion; 35 inherit majorVersion version; 36 37 inherit buildInputs; 38 39 src = fetchurl { 40 url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.xz"; 41 sha256 = "0gsxpgd5p4mwd01gw501vsyahncyw3h9836ypkr3y32kgazy89jj"; 42 }; 43 44 NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s"; 45 46 preConfigure = '' 47 for i in /usr /sw /opt /pkg; do # improve purity 48 substituteInPlace ./setup.py --replace $i /no-such-path 49 done 50 ${optionalString stdenv.isDarwin ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"''} 51 52 configureFlagsArray=( --enable-shared --with-threads 53 CPPFLAGS="${concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs)}" 54 LDFLAGS="${concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs)}" 55 LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}" 56 ) 57 ''; 58 59 setupHook = ./setup-hook.sh; 60 61 postInstall = '' 62 # needed for some packages, especially packages that backport functionality 63 # to 2.x from 3.x 64 for item in $out/lib/python${majorVersion}/test/*; do 65 if [[ "$item" != */test_support.py* ]]; then 66 rm -rf "$item" 67 else 68 echo $item 69 fi 70 done 71 touch $out/lib/python${majorVersion}/test/__init__.py 72 ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}" 73 paxmark E $out/bin/python${majorVersion} 74 ''; 75 76 passthru = rec { 77 zlibSupport = zlib != null; 78 sqliteSupport = sqlite != null; 79 dbSupport = db != null; 80 readlineSupport = readline != null; 81 opensslSupport = openssl != null; 82 tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null); 83 libPrefix = "python${majorVersion}"; 84 executable = "python3.3m"; 85 buildEnv = callPackage ../../wrapper.nix { python = self; }; 86 withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python33Packages; }; 87 isPy3 = true; 88 isPy33 = true; 89 is_py3k = true; # deprecated 90 sitePackages = "lib/${libPrefix}/site-packages"; 91 interpreter = "${self}/bin/${executable}"; 92 }; 93 94 enableParallelBuilding = true; 95 96 meta = { 97 homepage = http://python.org; 98 description = "A high-level dynamically-typed programming language"; 99 longDescription = '' 100 Python is a remarkably powerful dynamic programming language that 101 is used in a wide variety of application domains. Some of its key 102 distinguishing features include: clear, readable syntax; strong 103 introspection capabilities; intuitive object orientation; natural 104 expression of procedural code; full modularity, supporting 105 hierarchical packages; exception-based error handling; and very 106 high level dynamic data types. 107 ''; 108 license = stdenv.lib.licenses.psfl; 109 platforms = with stdenv.lib.platforms; linux ++ darwin; 110 maintainers = with stdenv.lib.maintainers; [ chaoflow cstrahan ]; 111 }; 112}