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
This commit is contained in:
Peter Simons 2012-04-27 08:20:46 +00:00
parent fa276c45dd
commit 27de563164
6 changed files with 19 additions and 149 deletions

View file

@ -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 ];
};
}

View file

@ -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']

View file

@ -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)

View file

@ -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}";
};

View file

@ -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

View file

@ -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;