Added "python-$version-wrapper" expression.

The python wrapper expression expects a list of Python modules, $extraLibs,
which are added to $PYTHONPATH before executing the actual Python interpreter.

svn path=/nixpkgs/trunk/; revision=23194
This commit is contained in:
Peter Simons 2010-08-16 17:03:35 +00:00
parent 42b5198e5b
commit 9670fca780
7 changed files with 40 additions and 12 deletions

View File

@ -8,14 +8,16 @@ let
buildInputs =
optional (stdenv ? gcc && stdenv.gcc.libc != null) stdenv.gcc.libc ++
[bzip2] ++
[bzip2] ++
optional zlibSupport zlib;
in
stdenv.mkDerivation {
name = "python-2.4.6";
majorVersion = "2.4";
version = "2.4.6";
src = fetchurl {
url = http://www.python.org/ftp/python/2.4.6/Python-2.4.6.tar.bz2;
sha256 = "021y88a4ki07dgq19yhg6zfvmncfiz7h5b2255438i9zmlwl246s";
@ -25,22 +27,22 @@ stdenv.mkDerivation {
# 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";
preConfigure = ''
# Purity.
for i in /usr /sw /opt /pkg; do
for i in /usr /sw /opt /pkg; do
substituteInPlace ./setup.py --replace $i /no-such-path
done
'';
setupHook = ./setup-hook.sh;
postInstall = ''
rm -rf $out/lib/python2.4/test
'';

View File

@ -39,7 +39,9 @@ in
stdenv.mkDerivation ( {
name = "python-2.5.4";
majorVersion = "2.5";
version = "2.5.4";
src = fetchurl {
url = http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tar.bz2;
sha256 = "0401g346ixng1im6gp11rgkfhx3v05qrpn5qjfx26mgy5dm8k3dw";
@ -49,15 +51,15 @@ stdenv.mkDerivation ( {
# 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
for i in /usr /sw /opt /pkg; do
substituteInPlace ./setup.py --replace $i /no-such-path
done
'' + (if readline != null then ''
@ -65,7 +67,7 @@ stdenv.mkDerivation ( {
'' else "");
setupHook = ./setup-hook.sh;
postInstall = ''
rm -rf $out/lib/python2.5/test
'';

View File

@ -47,6 +47,7 @@ in
stdenv.mkDerivation ( {
name = "python-${version}";
inherit majorVersion version;
src = fetchurl {
url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.bz2";

View File

@ -47,6 +47,7 @@ in
stdenv.mkDerivation ( {
name = "python-${version}";
inherit majorVersion version;
src = fetchurl {
url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.bz2";

View File

@ -49,6 +49,7 @@ in
stdenv.mkDerivation ( {
name = "python3-${version}";
inherit majorVersion version;
src = fetchurl {
url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.bz2";

View File

@ -0,0 +1,19 @@
{stdenv, python, makeWrapper, extraLibs ? []}:
stdenv.mkDerivation {
name = "python-${python.version}-wrapper";
propagatedBuildInputs = [python makeWrapper] ++ extraLibs;
unpackPhase = "true";
installPhase = ''
ensureDir "$out/bin"
declare -p
for prg in 2to3 idle pydoc python python-config python${python.majorVersion} python${python.majorVersion}-config smtpd.py; do
makeWrapper "$python/bin/$prg" "$out/bin/$prg" --set PYTHONPATH "$PYTHONPATH"
done
'';
inherit python;
inherit (python) meta;
}

View File

@ -2081,6 +2081,8 @@ let
pythonBase = python26Base;
pythonFull = python26Full;
pythonWrapper = callPackage ../development/interpreters/python/wrapper.nix { };
python24 = callPackage ../development/interpreters/python/2.4 { };
python25Base = makeOverridable (import ../development/interpreters/python/2.5) {