From 0b25624891b1045953aed021fb649952fbfb1fc0 Mon Sep 17 00:00:00 2001 From: Peter Simons <simons@cryp.to> Date: Mon, 19 Oct 2009 23:10:09 +0000 Subject: [PATCH] python 2.6.3: initial version of python 2.6 support The build succeeds on i686-linux. Other platforms look good, too, because there were hardly any changes necessary to update the expression from 2.5. svn path=/nixpkgs/trunk/; revision=17889 --- .../interpreters/python/2.6/default.nix | 86 +++++++++++++++++++ .../python/2.6/nolongdouble.patch | 20 +++++ .../interpreters/python/2.6/search-path.patch | 27 ++++++ .../interpreters/python/2.6/setup-hook.sh | 15 ++++ pkgs/top-level/all-packages.nix | 16 ++++ 5 files changed, 164 insertions(+) create mode 100644 pkgs/development/interpreters/python/2.6/default.nix create mode 100644 pkgs/development/interpreters/python/2.6/nolongdouble.patch create mode 100644 pkgs/development/interpreters/python/2.6/search-path.patch create mode 100644 pkgs/development/interpreters/python/2.6/setup-hook.sh diff --git a/pkgs/development/interpreters/python/2.6/default.nix b/pkgs/development/interpreters/python/2.6/default.nix new file mode 100644 index 000000000000..fc1323234ab4 --- /dev/null +++ b/pkgs/development/interpreters/python/2.6/default.nix @@ -0,0 +1,86 @@ +{ stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2 +, gdbmSupport ? true, gdbm ? null +, sqlite ? null +, db4 ? null +, readline ? null +, openssl ? null +, tk ? null +, tcl ? null +, libX11 ? null +, xproto ? null +}: + +assert zlibSupport -> zlib != null; +assert gdbmSupport -> gdbm != null; + +with stdenv.lib; + +let + + buildInputs = + optional (stdenv ? gcc && stdenv.gcc.libc != null) stdenv.gcc.libc ++ + [bzip2] + ++ optional zlibSupport zlib + ++ optional gdbmSupport gdbm + ++ optional (sqlite != null) sqlite + ++ optional (db4 != null) db4 + ++ optional (readline != null) readline + ++ optional (openssl != null) openssl + ++ optional (tk != null) tk + ++ optional (tcl != null) tcl + ++ optional (libX11 != null) libX11 + ++ optional (xproto != null) xproto + ; + +in + +stdenv.mkDerivation ( { + name = "python-2.6.3"; + + src = fetchurl { + url = http://www.python.org/ftp/python/2.6.3/Python-2.6.3.tar.bz2; + sha256 = "096wxhibhss3clgcj5n3xx5wmdsqmywk3h3bp68sicp7sy4y6rs3"; + }; + + patches = [ + # Look in C_INCLUDE_PATH and LIBRARY_PATH for stuff. + ./search-path.patch + ]; + + inherit buildInputs; + C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); + LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); + configureFlags = "--enable-shared --with-wctype-functions"; + + preConfigure = '' + # Purity. + for i in /usr /sw /opt /pkg; do + substituteInPlace ./setup.py --replace $i /no-such-path + done + '' + (if readline != null then '' + export NIX_LDFLAGS="$NIX_LDFLAGS -lncurses" + '' else ""); + + setupHook = ./setup-hook.sh; + + postInstall = '' + rm -rf $out/lib/python2.6/test + ''; + + passthru = { + inherit zlibSupport; + sqliteSupport = sqlite != null; + db4Support = db4 != null; + readlineSupport = readline != null; + opensslSupport = openssl != null; + tkSupport = (tk != null) && (tcl != null); + libPrefix = "python2.6"; + }; + + meta = { + # List of supported platforms. + # - On Darwin, `python.exe' fails with "Bus Error". + # platforms = stdenv.lib.platforms.allBut "i686-darwin"; + # Re-enabled for 2.6 to see whether the problem still occurs. + }; +} // (if stdenv.system == "i686-darwin" then { NIX_CFLAGS_COMPILE = "-msse2" ; patches = [./search-path.patch ./nolongdouble.patch]; } else {} ) ) diff --git a/pkgs/development/interpreters/python/2.6/nolongdouble.patch b/pkgs/development/interpreters/python/2.6/nolongdouble.patch new file mode 100644 index 000000000000..8fb53da3d49d --- /dev/null +++ b/pkgs/development/interpreters/python/2.6/nolongdouble.patch @@ -0,0 +1,20 @@ +diff -rc Python-2.5.4/configure Python-2.5.4-new/configure +*** Python-2.5.4/configure Sat Dec 13 15:13:52 2008 +--- Python-2.5.4-new/configure Fri Jul 24 16:38:05 2009 +*************** +*** 4534,4540 **** + ;; + # is there any other compiler on Darwin besides gcc? + Darwin*) +! BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd" + if test "${enable_universalsdk}"; then + BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + fi +--- 4534,4540 ---- + ;; + # is there any other compiler on Darwin besides gcc? + Darwin*) +! BASECFLAGS="$BASECFLAGS -no-cpp-precomp -mno-fused-madd" + if test "${enable_universalsdk}"; then + BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + fi diff --git a/pkgs/development/interpreters/python/2.6/search-path.patch b/pkgs/development/interpreters/python/2.6/search-path.patch new file mode 100644 index 000000000000..2e7b7526c0ce --- /dev/null +++ b/pkgs/development/interpreters/python/2.6/search-path.patch @@ -0,0 +1,27 @@ +diff -rc Python-2.4.4-orig/setup.py Python-2.4.4/setup.py +*** Python-2.4.4-orig/setup.py 2006-10-08 19:41:25.000000000 +0200 +--- Python-2.4.4/setup.py 2007-05-27 16:04:54.000000000 +0200 +*************** +*** 279,288 **** + # Check for AtheOS which has libraries in non-standard locations + if platform == 'atheos': + lib_dirs += ['/system/libs', '/atheos/autolnk/lib'] +- lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep) + inc_dirs += ['/system/include', '/atheos/autolnk/include'] +- inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) + + # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) + if platform in ['osf1', 'unixware7', 'openunix8']: + lib_dirs += ['/usr/ccs/lib'] +--- 279,289 ---- + # Check for AtheOS which has libraries in non-standard locations + if platform == 'atheos': + lib_dirs += ['/system/libs', '/atheos/autolnk/lib'] + inc_dirs += ['/system/include', '/atheos/autolnk/include'] + ++ lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep) ++ inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) ++ + # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) + if platform in ['osf1', 'unixware7', 'openunix8']: + lib_dirs += ['/usr/ccs/lib'] diff --git a/pkgs/development/interpreters/python/2.6/setup-hook.sh b/pkgs/development/interpreters/python/2.6/setup-hook.sh new file mode 100644 index 000000000000..290525c35713 --- /dev/null +++ b/pkgs/development/interpreters/python/2.6/setup-hook.sh @@ -0,0 +1,15 @@ +addPythonPath() { + addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/python2.6/site-packages +} + +toPythonPath() { + local paths="$1" + local result= + for i in $paths; do + p="$i/lib/python2.6/site-packages" + result="${result}${result:+:}$p" + done + echo $result +} + +envHooks=(${envHooks[@]} addPythonPath) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 672bc2fb3519..8197e5c67a78 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2406,6 +2406,22 @@ let xproto = if getConfig ["python" "tkSupport"] true then xlibs.xproto else null; }; + python26Base = composedArgsAndFun (import ../development/interpreters/python/2.6) { + inherit fetchurl stdenv zlib bzip2 gdbm; + }; + + python26Full = python26Base.passthru.function { + # FIXME: We lack ncurses support, needed, e.g., for `gpsd'. + db4 = if getConfig ["python" "db4Support"] true then db4 else null; + sqlite = if getConfig ["python" "sqliteSupport"] true then sqlite else null; + readline = if getConfig ["python" "readlineSupport"] true then readline else null; + openssl = if getConfig ["python" "opensslSupport"] true then openssl else null; + tk = if getConfig ["python" "tkSupport"] true then tk else null; + tcl = if getConfig ["python" "tkSupport"] true then tcl else null; + libX11 = if getConfig ["python" "tkSupport"] true then xlibs.libX11 else null; + xproto = if getConfig ["python" "tkSupport"] true then xlibs.xproto else null; + }; + # new python and lib proposal # - adding a python lib to buildinputs should be enough # (handles .pth files by patching site.py