From c44c00d56c0536a7b75ba78df5ad3fb1def7c681 Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Thu, 23 Oct 2014 12:07:07 +0200 Subject: [PATCH] python: adding test/test_support.py module in all python versions - test/test_support.py module is used by many libraries which backport python 3.0 functionality to 2.6/2.7 - enable subprocess32 tests (now passing for python 2.6/2.7) --- .../interpreters/python/2.6/default.nix | 9 ++++++++- .../interpreters/python/2.7/default.nix | 11 ++++++++++- .../interpreters/python/3.2/default.nix | 12 +++++++++++- .../interpreters/python/3.3/default.nix | 12 ++++++++++-- .../interpreters/python/3.4/default.nix | 13 +++++++++++-- pkgs/top-level/python-packages.nix | 16 +++++++++++++++- 6 files changed, 65 insertions(+), 8 deletions(-) diff --git a/pkgs/development/interpreters/python/2.6/default.nix b/pkgs/development/interpreters/python/2.6/default.nix index 97c96133aa5..c151db8ea18 100644 --- a/pkgs/development/interpreters/python/2.6/default.nix +++ b/pkgs/development/interpreters/python/2.6/default.nix @@ -67,7 +67,14 @@ let postInstall = '' - rm -rf "$out/lib/python${majorVersion}/test" + # needed for some packages, especially packages that backport + # functionality to 2.x from 3.x + for item in $out/lib/python${majorVersion}/test/*; do + if [[ "$item" != */test_support.py* ]]; then + rm -rf "$item" + fi + done + touch $out/lib/python${majorVersion}/test/__init__.py ln -s $out/lib/python${majorVersion}/pdb.py $out/bin/pdb ln -s $out/lib/python${majorVersion}/pdb.py $out/bin/pdb${majorVersion} mv $out/share/man/man1/{python.1,python2.6.1} diff --git a/pkgs/development/interpreters/python/2.7/default.nix b/pkgs/development/interpreters/python/2.7/default.nix index f9c7b4fb26a..7ebc9d3e356 100644 --- a/pkgs/development/interpreters/python/2.7/default.nix +++ b/pkgs/development/interpreters/python/2.7/default.nix @@ -73,7 +73,16 @@ let postInstall = '' - rm -rf "$out/lib/python${majorVersion}/test" + # needed for some packages, especially packages that backport + # functionality to 2.x from 3.x + for item in $out/lib/python${majorVersion}/test/*; do + if [[ "$item" != */test_support.py* ]]; then + rm -rf "$item" + else + echo $item + fi + done + touch $out/lib/python${majorVersion}/test/__init__.py ln -s $out/lib/python${majorVersion}/pdb.py $out/bin/pdb ln -s $out/lib/python${majorVersion}/pdb.py $out/bin/pdb${majorVersion} ln -s $out/share/man/man1/{python2.7.1.gz,python.1.gz} diff --git a/pkgs/development/interpreters/python/3.2/default.nix b/pkgs/development/interpreters/python/3.2/default.nix index dcc90ea5519..c684266f822 100644 --- a/pkgs/development/interpreters/python/3.2/default.nix +++ b/pkgs/development/interpreters/python/3.2/default.nix @@ -58,8 +58,18 @@ stdenv.mkDerivation { setupHook = ./setup-hook.sh; postInstall = '' - rm -rf "$out/lib/python${majorVersion}/test" + # needed for some packages, especially packages that backport functionality + # to 2.x from 3.x + for item in $out/lib/python${majorVersion}/test/*; do + if [[ "$item" != */test_support.py* ]]; then + rm -rf "$item" + else + echo $item + fi + done + touch $out/lib/python${majorVersion}/test/__init__.py ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}" + paxmark E $out/bin/python${majorVersion} ''; passthru = rec { diff --git a/pkgs/development/interpreters/python/3.3/default.nix b/pkgs/development/interpreters/python/3.3/default.nix index 450abfa772b..b9ab8231613 100644 --- a/pkgs/development/interpreters/python/3.3/default.nix +++ b/pkgs/development/interpreters/python/3.3/default.nix @@ -53,9 +53,17 @@ stdenv.mkDerivation { setupHook = ./setup-hook.sh; postInstall = '' - rm -rf "$out/lib/python${majorVersion}/test" + # needed for some packages, especially packages that backport functionality + # to 2.x from 3.x + for item in $out/lib/python${majorVersion}/test/*; do + if [[ "$item" != */test_support.py* ]]; then + rm -rf "$item" + else + echo $item + fi + done + touch $out/lib/python${majorVersion}/test/__init__.py ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}" - paxmark E $out/bin/python${majorVersion} ''; diff --git a/pkgs/development/interpreters/python/3.4/default.nix b/pkgs/development/interpreters/python/3.4/default.nix index b76b00047ba..e585c6c148d 100644 --- a/pkgs/development/interpreters/python/3.4/default.nix +++ b/pkgs/development/interpreters/python/3.4/default.nix @@ -54,9 +54,18 @@ stdenv.mkDerivation { setupHook = ./setup-hook.sh; postInstall = '' - rm -rf "$out/lib/python${majorVersion}/test" - ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}" + # needed for some packages, especially packages that backport functionality + # to 2.x from 3.x + for item in $out/lib/python${majorVersion}/test/*; do + if [[ "$item" != */test_support.py* ]]; then + rm -rf "$item" + else + echo $item + fi + done + touch $out/lib/python${majorVersion}/test/__init__.py + ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}" paxmark E $out/bin/python${majorVersion} ''; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a416a93af65..809e648e910 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8608,7 +8608,21 @@ let md5 = "754c5ab9f533e764f931136974b618f1"; }; - doCheck = false; + buildInputs = [ pkgs.bash ]; + + preConfigure = '' + substituteInPlace test_subprocess32.py \ + --replace '/usr/' '${pkgs.bash}/' + ''; + + checkPhase = '' + TMP_PREFIX=`pwd`/tmp/$name + TMP_INSTALL_DIR=$TMP_PREFIX/lib/${pythonPackages.python.libPrefix}/site-packages + PYTHONPATH="$TMP_INSTALL_DIR:$PYTHONPATH" + mkdir -p $TMP_INSTALL_DIR + python setup.py develop --prefix $TMP_PREFIX + python test_subprocess32.py + ''; meta = { homepage = "https://pypi.python.org/pypi/subprocess32";