From 15c96da276efe087fa2971a6dab6ffec340d5bd6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 13 Dec 2006 18:03:08 +0000 Subject: [PATCH] * Python 2.4.4. * Added a setup hook for Python that adds Python packages in buildInputs to $PYTHONPATH. svn path=/nixpkgs/trunk/; revision=7338 --- .../interpreters/python/default.nix | 14 +++++++++++--- .../interpreters/python/setup-hook.sh | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/interpreters/python/setup-hook.sh diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix index 9ec6d468ecd5..a13f2d626886 100644 --- a/pkgs/development/interpreters/python/default.nix +++ b/pkgs/development/interpreters/python/default.nix @@ -3,14 +3,22 @@ assert zlibSupport -> zlib != null; stdenv.mkDerivation { - name = "python-2.4.3"; + name = "python-2.4.4"; src = fetchurl { - url = http://nix.cs.uu.nl/dist/tarballs/Python-2.4.3.tar.bz2; - md5 = "141c683447d5e76be1d2bd4829574f02"; + url = http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tar.bz2; + md5 = "0ba90c79175c017101100ebf5978e906"; }; buildInputs = [ (if zlibSupport then zlib else null) ]; inherit zlibSupport; configureFlags = "--enable-shared"; + + libPrefix = "python2.4"; + + postInstall = " + ensureDir $out/nix-support + cp ${./setup-hook.sh} $out/nix-support/setup-hook + rm -rf $out/lib/python2.4/test + "; } diff --git a/pkgs/development/interpreters/python/setup-hook.sh b/pkgs/development/interpreters/python/setup-hook.sh new file mode 100644 index 000000000000..3bc86c582298 --- /dev/null +++ b/pkgs/development/interpreters/python/setup-hook.sh @@ -0,0 +1,18 @@ +addPythonPath() { + local p=$1/lib/python2.4/site-packages + if test -d $p; then + export PYTHONPATH="${PYTHONPATH}${PYTHONPATH:+:}$p" + fi +} + +toPythonPath() { + local paths="$1" + local result= + for i in $paths; do + p="$i/lib/python2.4/site-packages" + result="${result}${result:+:}$p" + done + echo $result +} + +envHooks=(${envHooks[@]} addPythonPath)