Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

python: make 2.6 and 2.7 expr similar, introduce includeModules

When includeModules is true, python is built with all optional modules
as part of derivation.

+54 -62
+29 -24
pkgs/development/interpreters/python/2.6/default.nix
··· 1 - { stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2 2 - , sqlite, tcl, tk, x11, openssl, readline, db, ncurses, gdbm 3 - }: 4 5 assert zlibSupport -> zlib != null; 6 7 with stdenv.lib; 8 9 let 10 - 11 majorVersion = "2.6"; 12 version = "${majorVersion}.9"; 13 ··· 27 # the Nix store to 1. So treat that as a special case. 28 ./nix-store-mtime.patch 29 ]; 30 31 buildInputs = 32 optional (stdenv ? gcc && stdenv.gcc.libc != null) stdenv.gcc.libc ++ 33 - [ bzip2 openssl ] 34 ++ optional zlibSupport zlib; 35 36 37 # Build the basic Python interpreter without modules that have 38 # external dependencies. 39 python = stdenv.mkDerivation { 40 - name = "python-${version}"; 41 42 - inherit majorVersion version src patches buildInputs; 43 44 C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); 45 LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); 46 47 configureFlags = "--enable-shared --with-threads --enable-unicode"; 48 49 - preConfigure = 50 - '' 51 - # Purity. 52 - for i in /usr /sw /opt /pkg; do 53 - substituteInPlace ./setup.py --replace $i /no-such-path 54 - done 55 - '' + optionalString (stdenv ? gcc && stdenv.gcc.libc != null) '' 56 - for i in Lib/plat-*/regen; do 57 - substituteInPlace $i --replace /usr/include/ ${stdenv.gcc.libc}/include/ 58 - done 59 - ''; 60 - 61 NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2"; 62 63 setupHook = ./setup-hook.sh; ··· 69 ln -s $out/lib/python${majorVersion}/pdb.py $out/bin/pdb${majorVersion} 70 mv $out/share/man/man1/{python.1,python2.6.1} 71 ln -s $out/share/man/man1/{python2.6.1,python.1} 72 ''; 73 74 passthru = rec { ··· 96 ''; 97 license = stdenv.lib.licenses.psfl; 98 platforms = stdenv.lib.platforms.all; 99 - maintainers = with stdenv.lib.maintainers; [ simons chaoflow ]; 100 }; 101 }; 102 ··· 108 , internalName ? "_" + moduleName 109 , deps 110 }: 111 - stdenv.mkDerivation rec { 112 name = "python-${moduleName}-${python.version}"; 113 114 - inherit src patches; 115 116 buildInputs = [ python ] ++ deps; 117 118 C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); 119 LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); 120 - 121 - configurePhase = "true"; 122 123 buildPhase = 124 ''
··· 1 + { stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, includeModules ? false 2 + , sqlite, tcl, tk, x11, openssl, readline, db, ncurses, gdbm}: 3 4 assert zlibSupport -> zlib != null; 5 6 with stdenv.lib; 7 8 let 9 majorVersion = "2.6"; 10 version = "${majorVersion}.9"; 11 ··· 25 # the Nix store to 1. So treat that as a special case. 26 ./nix-store-mtime.patch 27 ]; 28 + 29 + preConfigure = '' 30 + # Purity. 31 + for i in /usr /sw /opt /pkg; do 32 + substituteInPlace ./setup.py --replace $i /no-such-path 33 + done 34 + '' + optionalString (stdenv ? gcc && stdenv.gcc.libc != null) '' 35 + for i in Lib/plat-*/regen; do 36 + substituteInPlace $i --replace /usr/include/ ${stdenv.gcc.libc}/include/ 37 + done 38 + '' + optionalString stdenv.isCygwin '' 39 + # On Cygwin, `make install' tries to read this Makefile. 40 + mkdir -p $out/lib/python${majorVersion}/config 41 + touch $out/lib/python${majorVersion}/config/Makefile 42 + mkdir -p $out/include/python${majorVersion} 43 + touch $out/include/python${majorVersion}/pyconfig.h 44 + ''; 45 46 buildInputs = 47 optional (stdenv ? gcc && stdenv.gcc.libc != null) stdenv.gcc.libc ++ 48 + [ bzip2 openssl ]++ optionals includeModules [ db openssl ncurses gdbm readline x11 tcl tk sqlite ] 49 ++ optional zlibSupport zlib; 50 51 52 # Build the basic Python interpreter without modules that have 53 # external dependencies. 54 python = stdenv.mkDerivation { 55 + name = "python${if includeModules then "" else "-minimal"}-${version}"; 56 57 + inherit majorVersion version src patches buildInputs preConfigure; 58 59 C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); 60 LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); 61 62 configureFlags = "--enable-shared --with-threads --enable-unicode"; 63 64 NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2"; 65 66 setupHook = ./setup-hook.sh; ··· 72 ln -s $out/lib/python${majorVersion}/pdb.py $out/bin/pdb${majorVersion} 73 mv $out/share/man/man1/{python.1,python2.6.1} 74 ln -s $out/share/man/man1/{python2.6.1,python.1} 75 + 76 + paxmark E $out/bin/python${majorVersion} 77 + 78 + ${ optionalString includeModules "$out/bin/python ./setup.py build_ext"} 79 ''; 80 81 passthru = rec { ··· 103 ''; 104 license = stdenv.lib.licenses.psfl; 105 platforms = stdenv.lib.platforms.all; 106 + maintainers = with stdenv.lib.maintainers; [ simons chaoflow iElectric ]; 107 }; 108 }; 109 ··· 115 , internalName ? "_" + moduleName 116 , deps 117 }: 118 + if (includeModules) then null else stdenv.mkDerivation rec { 119 name = "python-${moduleName}-${python.version}"; 120 121 + inherit src patches preConfigure; 122 123 buildInputs = [ python ] ++ deps; 124 125 C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); 126 LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); 127 128 buildPhase = 129 ''
+25 -38
pkgs/development/interpreters/python/2.7/default.nix
··· 1 - { stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2 2 , sqlite, tcl, tk, x11, openssl, readline, db, ncurses, gdbm, libX11 }: 3 4 assert zlibSupport -> zlib != null; ··· 6 with stdenv.lib; 7 8 let 9 - 10 majorVersion = "2.7"; 11 version = "${majorVersion}.8"; 12 ··· 29 # if DETERMINISTIC_BUILD env var is set 30 ./deterministic-build.patch 31 ]; 32 - 33 - postPatch = stdenv.lib.optionalString (stdenv.gcc.libc != null) '' 34 - substituteInPlace ./Lib/plat-generic/regen \ 35 - --replace /usr/include/netinet/in.h \ 36 - ${stdenv.gcc.libc}/include/netinet/in.h 37 - ''; 38 - 39 - buildInputs = 40 - optional (stdenv ? gcc && stdenv.gcc.libc != null) stdenv.gcc.libc ++ 41 - [ bzip2 openssl ] 42 - ++ optional zlibSupport zlib; 43 - 44 - ensurePurity = 45 - '' 46 # Purity. 47 for i in /usr /sw /opt /pkg; do 48 substituteInPlace ./setup.py --replace $i /no-such-path 49 done 50 ''; 51 52 # Build the basic Python interpreter without modules that have 53 # external dependencies. 54 python = stdenv.mkDerivation { 55 name = "python-${version}"; 56 57 - inherit majorVersion version src patches postPatch buildInputs; 58 59 LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s"; 60 C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); ··· 62 63 configureFlags = "--enable-shared --with-threads --enable-unicode"; 64 65 - preConfigure = "${ensurePurity}" + optionalString stdenv.isCygwin 66 - '' 67 - # On Cygwin, `make install' tries to read this Makefile. 68 - mkdir -p $out/lib/python${majorVersion}/config 69 - touch $out/lib/python${majorVersion}/config/Makefile 70 - mkdir -p $out/include/python${majorVersion} 71 - touch $out/include/python${majorVersion}/pyconfig.h 72 - ''; 73 - 74 NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2"; 75 76 setupHook = ./setup-hook.sh; ··· 83 ln -s $out/share/man/man1/{python2.7.1.gz,python.1.gz} 84 85 paxmark E $out/bin/python${majorVersion} 86 ''; 87 88 passthru = rec { ··· 110 ''; 111 license = stdenv.lib.licenses.psfl; 112 platforms = stdenv.lib.platforms.all; 113 - maintainers = with stdenv.lib.maintainers; [ simons chaoflow ]; 114 }; 115 }; 116 ··· 122 , internalName ? "_" + moduleName 123 , deps 124 }: 125 - stdenv.mkDerivation rec { 126 name = "python-${moduleName}-${python.version}"; 127 128 - inherit src patches postPatch; 129 130 buildInputs = [ python ] ++ deps; 131 132 C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); 133 LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); 134 135 - configurePhase = "${ensurePurity}"; 136 - 137 - buildPhase = 138 - '' 139 - # Fake the build environment that setup.py expects. 140 - ln -s ${python}/include/python*/pyconfig.h . 141 - ln -s ${python}/lib/python*/config/Setup Modules/ 142 - ln -s ${python}/lib/python*/config/Setup.local Modules/ 143 - 144 substituteInPlace setup.py --replace 'self.extensions = extensions' \ 145 'self.extensions = [ext for ext in self.extensions if ext.name in ["${internalName}"]]' 146
··· 1 + { stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, includeModules ? false 2 , sqlite, tcl, tk, x11, openssl, readline, db, ncurses, gdbm, libX11 }: 3 4 assert zlibSupport -> zlib != null; ··· 6 with stdenv.lib; 7 8 let 9 majorVersion = "2.7"; 10 version = "${majorVersion}.8"; 11 ··· 28 # if DETERMINISTIC_BUILD env var is set 29 ./deterministic-build.patch 30 ]; 31 + 32 + preConfigure = '' 33 # Purity. 34 for i in /usr /sw /opt /pkg; do 35 substituteInPlace ./setup.py --replace $i /no-such-path 36 done 37 + '' + optionalString (stdenv ? gcc && stdenv.gcc.libc != null) '' 38 + for i in Lib/plat-*/regen; do 39 + substituteInPlace $i --replace /usr/include/ ${stdenv.gcc.libc}/include/ 40 + done 41 + '' + optionalString stdenv.isCygwin '' 42 + # On Cygwin, `make install' tries to read this Makefile. 43 + mkdir -p $out/lib/python${majorVersion}/config 44 + touch $out/lib/python${majorVersion}/config/Makefile 45 + mkdir -p $out/include/python${majorVersion} 46 + touch $out/include/python${majorVersion}/pyconfig.h 47 ''; 48 49 + buildInputs = 50 + optional (stdenv ? gcc && stdenv.gcc.libc != null) stdenv.gcc.libc ++ 51 + [ bzip2 openssl ] ++ optionals includeModules [ db openssl ncurses gdbm libX11 readline x11 tcl tk sqlite ] 52 + ++ optional zlibSupport zlib; 53 + 54 # Build the basic Python interpreter without modules that have 55 # external dependencies. 56 python = stdenv.mkDerivation { 57 name = "python-${version}"; 58 59 + inherit majorVersion version src patches buildInputs preConfigure; 60 61 LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s"; 62 C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); ··· 64 65 configureFlags = "--enable-shared --with-threads --enable-unicode"; 66 67 NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2"; 68 69 setupHook = ./setup-hook.sh; ··· 76 ln -s $out/share/man/man1/{python2.7.1.gz,python.1.gz} 77 78 paxmark E $out/bin/python${majorVersion} 79 + 80 + ${ optionalString includeModules "$out/bin/python ./setup.py build_ext"} 81 ''; 82 83 passthru = rec { ··· 105 ''; 106 license = stdenv.lib.licenses.psfl; 107 platforms = stdenv.lib.platforms.all; 108 + maintainers = with stdenv.lib.maintainers; [ simons chaoflow iElectric ]; 109 }; 110 }; 111 ··· 117 , internalName ? "_" + moduleName 118 , deps 119 }: 120 + if (includeModules) then null else stdenv.mkDerivation rec { 121 name = "python-${moduleName}-${python.version}"; 122 123 + inherit src patches preConfigure; 124 125 buildInputs = [ python ] ++ deps; 126 127 C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); 128 LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); 129 130 + buildPhase = '' 131 substituteInPlace setup.py --replace 'self.extensions = extensions' \ 132 'self.extensions = [ext for ext in self.extensions if ext.name in ["${internalName}"]]' 133