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