From 27de56316468dad84e589540faec91c179f29377 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Fri, 27 Apr 2012 08:20:46 +0000 Subject: [PATCH] Updated Python 3.x. - updated to version 3.2.3 - fixed version numbers in setup-hook.sh - sort input variable list alphabetically - tk support needs x11 support as well - deleted obsolete version 3.1 Furthermore, all CPPFLAGS and LDFLAGS required to find the build inputs are now explicitly passed to ./configure. The python 3.x build systems tries to ignore the environment as much as possible to provide deterministic builds. This means that our magic environment variable stuff won't work, and previously built python3 binaries lacked all kinds of extensions, such as zlib, etc. svn path=/nixpkgs/trunk/; revision=33937 --- .../interpreters/python/3.1/default.nix | 85 ------------------- .../interpreters/python/3.1/search-path.patch | 27 ------ .../interpreters/python/3.1/setup-hook.sh | 15 ---- .../interpreters/python/3.2/default.nix | 35 ++++---- .../interpreters/python/3.2/setup-hook.sh | 4 +- pkgs/top-level/all-packages.nix | 2 - 6 files changed, 19 insertions(+), 149 deletions(-) delete mode 100644 pkgs/development/interpreters/python/3.1/default.nix delete mode 100644 pkgs/development/interpreters/python/3.1/search-path.patch delete mode 100644 pkgs/development/interpreters/python/3.1/setup-hook.sh diff --git a/pkgs/development/interpreters/python/3.1/default.nix b/pkgs/development/interpreters/python/3.1/default.nix deleted file mode 100644 index 92b090bb41e..00000000000 --- a/pkgs/development/interpreters/python/3.1/default.nix +++ /dev/null @@ -1,85 +0,0 @@ -{ stdenv, fetchurl -, zlib -, bzip2 -, gdbm -, sqlite -, db4 -, ncurses -, readline -, openssl -, tcl, tk -, libX11, xproto -}: - -assert readline != null -> ncurses != null; - -with stdenv.lib; - -let - majorVersion = "3.1"; - version = "${majorVersion}.3"; - - buildInputs = filter (p: p != null) [ - zlib bzip2 gdbm sqlite db4 readline ncurses openssl tcl tk libX11 xproto - ]; -in -stdenv.mkDerivation { - name = "python3-${version}"; - inherit majorVersion version; - - src = fetchurl { - url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.bz2"; - sha256 = "1jsqapgwrcqcaskyi2qdn1xj7l8x5340a137hdfshk5ya4dg9xkp"; - }; - - inherit buildInputs; - patches = [ ./search-path.patch ]; - - C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); - LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); - configureFlags = "--enable-shared --with-threads --enable-unicode --with-wctype-functions"; - - preConfigure = '' - for i in /usr /sw /opt /pkg; do # improve purity - substituteInPlace ./setup.py --replace $i /no-such-path - done - ${optionalString (ncurses != null) ''export NIX_LDFLAGS="$NIX_LDFLAGS -lncurses"''} - ${optionalString stdenv.isDarwin ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"''} - ''; - - setupHook = ./setup-hook.sh; - - postInstall = '' - rm -rf "$out/lib/python${majorVersion}/test" - ''; - - passthru = { - zlibSupport = zlib != null; - sqliteSupport = sqlite != null; - db4Support = db4 != null; - readlineSupport = readline != null; - opensslSupport = openssl != null; - tkSupport = (tk != null) && (tcl != null); - libPrefix = "python${majorVersion}"; - }; - - enableParallelBuilding = true; - - meta = { - homepage = "http://python.org"; - description = "a high-level dynamically-typed programming language"; - longDescription = '' - Python is a remarkably powerful dynamic programming language that - is used in a wide variety of application domains. Some of its key - distinguishing features include: clear, readable syntax; strong - introspection capabilities; intuitive object orientation; natural - expression of procedural code; full modularity, supporting - hierarchical packages; exception-based error handling; and very - high level dynamic data types. - ''; - license = stdenv.lib.licenses.psfl; - platforms = stdenv.lib.platforms.all; - maintainers = with stdenv.lib.maintainers; [ simons chaoflow ]; - }; - -} diff --git a/pkgs/development/interpreters/python/3.1/search-path.patch b/pkgs/development/interpreters/python/3.1/search-path.patch deleted file mode 100644 index 2e7b7526c0c..00000000000 --- a/pkgs/development/interpreters/python/3.1/search-path.patch +++ /dev/null @@ -1,27 +0,0 @@ -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/3.1/setup-hook.sh b/pkgs/development/interpreters/python/3.1/setup-hook.sh deleted file mode 100644 index 09a086714bb..00000000000 --- a/pkgs/development/interpreters/python/3.1/setup-hook.sh +++ /dev/null @@ -1,15 +0,0 @@ -addPythonPath() { - addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/python3.1/site-packages -} - -toPythonPath() { - local paths="$1" - local result= - for i in $paths; do - p="$i/lib/python3.1/site-packages" - result="${result}${result:+:}$p" - done - echo $result -} - -envHooks=(${envHooks[@]} addPythonPath) diff --git a/pkgs/development/interpreters/python/3.2/default.nix b/pkgs/development/interpreters/python/3.2/default.nix index 6e496e0ea1a..64442f2e35b 100644 --- a/pkgs/development/interpreters/python/3.2/default.nix +++ b/pkgs/development/interpreters/python/3.2/default.nix @@ -1,14 +1,14 @@ { stdenv, fetchurl -, zlib , bzip2 -, gdbm -, sqlite , db4 -, ncurses -, readline -, openssl -, tcl, tk +, gdbm , libX11, xproto +, ncurses +, openssl +, readline +, sqlite +, tcl, tk +, zlib }: assert readline != null -> ncurses != null; @@ -17,7 +17,7 @@ with stdenv.lib; let majorVersion = "3.2"; - version = "${majorVersion}"; + version = "${majorVersion}.3"; buildInputs = filter (p: p != null) [ zlib bzip2 gdbm sqlite db4 readline ncurses openssl tcl tk libX11 xproto @@ -29,21 +29,20 @@ stdenv.mkDerivation { src = fetchurl { url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.bz2"; - sha256 = "06awxchnv8gai6415pgzz2x8f1xi38v8a4anz6n39ciwq7v5zzbv"; + sha256 = "5648ec81f93870fde2f0aa4ed45c8718692b15ce6fd9ed309bfb827ae12010aa"; }; - inherit buildInputs; - - C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); - LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); - configureFlags = "--enable-shared --with-threads --enable-unicode --with-wctype-functions"; - preConfigure = '' for i in /usr /sw /opt /pkg; do # improve purity substituteInPlace ./setup.py --replace $i /no-such-path done - ${optionalString (ncurses != null) ''export NIX_LDFLAGS="$NIX_LDFLAGS -lncurses"''} - ${optionalString stdenv.isDarwin ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"''} + ${optionalString stdenv.isDarwin ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"''} + + configureFlagsArray=( --enable-shared --with-threads + CPPFLAGS="${concatStringsSep " " (map (p: "-I${p}/include") buildInputs)}" + LDFLAGS="${concatStringsSep " " (map (p: "-L${p}/lib") buildInputs)}" + LIBS="-lcrypt ${optionalString (ncurses != null) "-lncurses"}" + ) ''; setupHook = ./setup-hook.sh; @@ -58,7 +57,7 @@ stdenv.mkDerivation { db4Support = db4 != null; readlineSupport = readline != null; opensslSupport = openssl != null; - tkSupport = (tk != null) && (tcl != null); + tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null); libPrefix = "python${majorVersion}"; }; diff --git a/pkgs/development/interpreters/python/3.2/setup-hook.sh b/pkgs/development/interpreters/python/3.2/setup-hook.sh index 09a086714bb..e6fa34bf54b 100644 --- a/pkgs/development/interpreters/python/3.2/setup-hook.sh +++ b/pkgs/development/interpreters/python/3.2/setup-hook.sh @@ -1,12 +1,12 @@ addPythonPath() { - addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/python3.1/site-packages + addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/python3.2/site-packages } toPythonPath() { local paths="$1" local result= for i in $paths; do - p="$i/lib/python3.1/site-packages" + p="$i/lib/python3.2/site-packages" result="${result}${result:+:}$p" done echo $result diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 76302a63b8e..733b758f105 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2757,8 +2757,6 @@ let python27 = callPackage ../development/interpreters/python/2.7 { }; - python31 = callPackage ../development/interpreters/python/3.1 { }; - python32 = callPackage ../development/interpreters/python/3.2 { }; pythonFull = python27Full;