about summary refs log tree commit diff
path: root/pkgs/development/interpreters/pypy/2.3/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/pypy/2.3/default.nix')
-rw-r--r--pkgs/development/interpreters/pypy/2.3/default.nix22
1 files changed, 17 insertions, 5 deletions
diff --git a/pkgs/development/interpreters/pypy/2.3/default.nix b/pkgs/development/interpreters/pypy/2.3/default.nix
index d67f1c2a8215..0ed13e2f6462 100644
--- a/pkgs/development/interpreters/pypy/2.3/default.nix
+++ b/pkgs/development/interpreters/pypy/2.3/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, pkgconfig, libffi
-, sqlite, openssl, ncurses, pythonFull, expat }:
+, sqlite, openssl, ncurses, pythonFull, expat, tcl, tk, x11, libX11 }:
 
 assert zlibSupport -> zlib != null;
 
@@ -20,7 +20,7 @@ let
       sha256 = "0fg4l48c7n59n5j3b1dgcsr927xzylkfny4a6pnk6z0pq2bhvl9z";
     };
 
-    buildInputs = [ bzip2 openssl pkgconfig pythonFull libffi ncurses expat sqlite ]
+    buildInputs = [ bzip2 openssl pkgconfig pythonFull libffi ncurses expat sqlite tk tcl x11 libX11 ]
       ++ stdenv.lib.optional (stdenv ? gcc && stdenv.gcc.libc != null) stdenv.gcc.libc
       ++ stdenv.lib.optional zlibSupport zlib;
 
@@ -40,12 +40,20 @@ let
       substituteInPlace pypy/goal/targetpypystandalone.py \
         --replace "/usr/bin/env pypy" "${pythonFull}/bin/python"
 
-      # convince pypy to find nix ncurses
+      # hint pypy to find nix ncurses
       substituteInPlace pypy/module/_minimal_curses/fficurses.py \
         --replace "/usr/include/ncurses/curses.h" "${ncurses}/include/curses.h" \
         --replace "ncurses/curses.h" "${ncurses}/include/curses.h" \
         --replace "ncurses/term.h" "${ncurses}/include/term.h" \
         --replace "libraries=['curses']" "libraries=['ncurses']"
+
+      # tkinter hints
+      substituteInPlace lib_pypy/_tkinter/tklib.py \
+        --replace "'/usr/include/tcl'" "'${tk}/include', '${tcl}/include'" \
+        --replace "linklibs=['tcl', 'tk']" "linklibs=['tcl8.5', 'tk8.5']" \
+        --replace "libdirs = []" "libdirs = ['${tk}/lib', '${tcl}/lib']"
+
+      sed -i "s@libraries=\['sqlite3'\]\$@libraries=['sqlite3'], include_dirs=['${sqlite}/include'], library_dirs=['${sqlite}/lib']@" lib_pypy/_sqlite3.py
     '';
 
     setupHook = ./setup-hook.sh;
@@ -58,8 +66,8 @@ let
        # disable shutils because it assumes gid 0 exists
        # disable socket because it has two actual network tests that fail
        # disable test_mhlib because it fails for unknown reason
-       # disable test_multiprocessing due to transient errors
        # disable sqlite3 due to https://bugs.pypy.org/issue1740
+       # disable test_multiprocessing due to transient errors
        # disable test_os because test_urandom_failure fails
       ./pypy-c ./pypy/test_all.py --pypy=./pypy-c -k '-test_sqlite -test_socket -test_os -test_shutil -test_mhlib -test_multiprocessing' lib-python
     '';
@@ -75,19 +83,23 @@ let
        ln -s $out/pypy-c/include $out/include/${libPrefix}
        ln -s $out/pypy-c/lib-python/${pythonVersion} $out/lib/${libPrefix}
 
+       # verify cffi modules
+       $out/bin/pypy -c "import Tkinter;import sqlite3"
+
        # TODO: compile python files?
     '';
 
     passthru = {
       inherit zlibSupport libPrefix;
       executable = "pypy";
+      isPypy = true;
     };
 
     enableParallelBuilding = true;
 
     meta = with stdenv.lib; {
       homepage = "http://pypy.org/";
-      description = "PyPy is a fast, compliant alternative implementation of the Python language (2.7.3)";
+      description = "Fast, compliant alternative implementation of the Python language (2.7.3)";
       license = licenses.mit;
       platforms = platforms.linux;
       maintainers = with maintainers; [ iElectric ];