Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 16.09 136 lines 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 substituteInPlace configure --replace '-Wl,-stack_size,1000000' ' ' 64 ''; 65 66 preConfigure = '' 67 for i in /usr /sw /opt /pkg; do # improve purity 68 substituteInPlace ./setup.py --replace $i /no-such-path 69 done 70 ${optionalString stdenv.isDarwin '' 71 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2" 72 export MACOSX_DEPLOYMENT_TARGET=10.6 73 ''} 74 75 configureFlagsArray=( --enable-shared --with-threads 76 CPPFLAGS="${concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs)}" 77 LDFLAGS="${concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs)}" 78 LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}" 79 ) 80 ''; 81 82 setupHook = ./setup-hook.sh; 83 84 postInstall = '' 85 # needed for some packages, especially packages that backport functionality 86 # to 2.x from 3.x 87 for item in $out/lib/python${majorVersion}/test/*; do 88 if [[ "$item" != */test_support.py* ]]; then 89 rm -rf "$item" 90 else 91 echo $item 92 fi 93 done 94 touch $out/lib/python${majorVersion}/test/__init__.py 95 96 ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}" 97 paxmark E $out/bin/python${majorVersion} 98 ''; 99 100 passthru = rec { 101 zlibSupport = zlib != null; 102 sqliteSupport = sqlite != null; 103 dbSupport = db != null; 104 readlineSupport = readline != null; 105 opensslSupport = openssl != null; 106 tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null); 107 libPrefix = "python${majorVersion}"; 108 executable = "python3.4m"; 109 buildEnv = callPackage ../../wrapper.nix { python = self; }; 110 withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python34Packages; }; 111 isPy3 = true; 112 isPy34 = true; 113 is_py3k = true; # deprecated 114 sitePackages = "lib/${libPrefix}/site-packages"; 115 interpreter = "${self}/bin/${executable}"; 116 }; 117 118 enableParallelBuilding = true; 119 120 meta = { 121 homepage = http://python.org; 122 description = "A high-level dynamically-typed programming language"; 123 longDescription = '' 124 Python is a remarkably powerful dynamic programming language that 125 is used in a wide variety of application domains. Some of its key 126 distinguishing features include: clear, readable syntax; strong 127 introspection capabilities; intuitive object orientation; natural 128 expression of procedural code; full modularity, supporting 129 hierarchical packages; exception-based error handling; and very 130 high level dynamic data types. 131 ''; 132 license = licenses.psfl; 133 platforms = with platforms; linux ++ darwin; 134 maintainers = with maintainers; [ chaoflow domenkozar cstrahan ]; 135 }; 136}