summary refs log tree commit diff
path: root/pkgs/development/interpreters/python
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2022-01-15 16:47:21 +0100
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2022-01-15 17:40:54 +0100
commit731db1820d8bcb2c03f1a5288cf68ef7b56fbd90 (patch)
treebfbc47fe5883100557e0a6daaafaccd60076e8f5 /pkgs/development/interpreters/python
parentf3a0ca4172e22e46e1f77f149be71b49c9c3fd0c (diff)
downloadnixpkgs-731db1820d8bcb2c03f1a5288cf68ef7b56fbd90.tar
nixpkgs-731db1820d8bcb2c03f1a5288cf68ef7b56fbd90.tar.gz
nixpkgs-731db1820d8bcb2c03f1a5288cf68ef7b56fbd90.tar.bz2
nixpkgs-731db1820d8bcb2c03f1a5288cf68ef7b56fbd90.tar.lz
nixpkgs-731db1820d8bcb2c03f1a5288cf68ef7b56fbd90.tar.xz
nixpkgs-731db1820d8bcb2c03f1a5288cf68ef7b56fbd90.tar.zst
nixpkgs-731db1820d8bcb2c03f1a5288cf68ef7b56fbd90.zip
pythonInterpreters.pypy27_prebuilt: 7.3.3 -> 7.3.6
Diffstat (limited to 'pkgs/development/interpreters/python')
-rw-r--r--pkgs/development/interpreters/python/default.nix6
-rw-r--r--pkgs/development/interpreters/python/pypy/prebuilt_2_7.nix132
2 files changed, 135 insertions, 3 deletions
diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix
index 91029b302c2..957b516cc2b 100644
--- a/pkgs/development/interpreters/python/default.nix
+++ b/pkgs/development/interpreters/python/default.nix
@@ -273,15 +273,15 @@ in {
     sha256 = "sha256-LtAqyecQhZxBvILer7CGGXkruaJ+6qFnbHQe3t0hTdc=";
   };
 
-  pypy27_prebuilt = callPackage ./pypy/prebuilt.nix {
+  pypy27_prebuilt = callPackage ./pypy/prebuilt_2_7.nix {
     # Not included at top-level
     self = pythonInterpreters.pypy27_prebuilt;
     sourceVersion = {
       major = "7";
       minor = "3";
-      patch = "3";
+      patch = "6";
     };
-    sha256 = "1cfpdyvbvzwc0ynjr7248jhwgcpl7073wlp7w3g2v4fnrh1bc4pl"; # linux64
+    sha256 = "sha256-ghJ/Q/rmznXUfWxFOfjB6jcunC2/pA+ui1g1HVInk6Q="; # linux64
     pythonVersion = "2.7";
     inherit passthruFun;
   };
diff --git a/pkgs/development/interpreters/python/pypy/prebuilt_2_7.nix b/pkgs/development/interpreters/python/pypy/prebuilt_2_7.nix
new file mode 100644
index 00000000000..460af1cc67b
--- /dev/null
+++ b/pkgs/development/interpreters/python/pypy/prebuilt_2_7.nix
@@ -0,0 +1,132 @@
+{ lib
+, stdenv
+, fetchurl
+, python-setup-hook
+, self
+, which
+# Dependencies
+, bzip2
+, zlib
+, openssl_1_0_2
+, expat
+, ncurses6
+, tcl-8_5
+, tk-8_5
+# For the Python package set
+, packageOverrides ? (self: super: {})
+, sourceVersion
+, pythonVersion
+, sha256
+, passthruFun
+}:
+
+# This version of PyPy is primarily added to speed-up translation of
+# our PyPy source build when developing that expression.
+
+with lib;
+
+let
+  isPy3k = majorVersion == "3";
+  passthru = passthruFun {
+    inherit self sourceVersion pythonVersion packageOverrides;
+    implementation = "pypy";
+    libPrefix = "pypy${pythonVersion}";
+    executable = "pypy${if isPy3k then "3" else ""}";
+    sitePackages = "site-packages";
+    hasDistutilsCxxPatch = false;
+
+    # Not possible to cross-compile with.
+    pythonOnBuildForBuild = throw "${pname} does not support cross compilation";
+    pythonOnBuildForHost = self;
+    pythonOnBuildForTarget = throw "${pname} does not support cross compilation";
+    pythonOnHostForHost = throw "${pname} does not support cross compilation";
+    pythonOnTargetForTarget = throw "${pname} does not support cross compilation";
+  };
+  pname = "${passthru.executable}_prebuilt";
+  version = with sourceVersion; "${major}.${minor}.${patch}";
+
+  majorVersion = substring 0 1 pythonVersion;
+
+  deps = [
+    bzip2
+    zlib
+    openssl_1_0_2
+    expat
+    ncurses6
+    tcl-8_5
+    tk-8_5
+  ];
+
+in with passthru; stdenv.mkDerivation {
+  inherit pname version;
+
+  src = fetchurl {
+    url = "https://downloads.python.org/pypy/pypy${pythonVersion}-v${version}-linux64.tar.bz2";
+    inherit sha256;
+  };
+
+  buildInputs = [ which ];
+
+  installPhase = ''
+    mkdir -p $out/lib
+    echo "Moving files to $out"
+    mv -t $out bin include lib-python lib_pypy site-packages
+    mv lib/libffi.so.6* $out/lib/
+
+    mv $out/bin/libpypy*-c.so $out/lib/
+
+    rm $out/bin/*.debug
+
+    echo "Patching binaries"
+    interpreter=$(patchelf --print-interpreter $(readlink -f $(which patchelf)))
+    patchelf --set-interpreter $interpreter \
+             --set-rpath $out/lib \
+             $out/bin/pypy*
+
+    pushd $out
+    find {lib,lib_pypy*} -name "*.so" -exec patchelf --remove-needed libncursesw.so.6 --replace-needed libtinfow.so.6 libncursesw.so.6 {} \;
+    find {lib,lib_pypy*} -name "*.so" -exec patchelf --set-rpath ${lib.makeLibraryPath deps}:$out/lib {} \;
+
+    echo "Removing bytecode"
+    find . -name "__pycache__" -type d -depth -exec rm -rf {} \;
+    popd
+
+    # Include a sitecustomize.py file
+    cp ${../sitecustomize.py} $out/${sitePackages}/sitecustomize.py
+
+  '';
+
+  doInstallCheck = true;
+
+  # Check whether importing of (extension) modules functions
+  installCheckPhase = let
+    modules = [
+      "ssl"
+      "sys"
+      "curses"
+    ] ++ optionals (!isPy3k) [
+      "Tkinter"
+    ] ++ optionals isPy3k [
+      "tkinter"
+    ];
+    imports = concatMapStringsSep "; " (x: "import ${x}") modules;
+  in ''
+    echo "Testing whether we can import modules"
+    $out/bin/${executable} -c '${imports}'
+  '';
+
+  setupHook = python-setup-hook sitePackages;
+
+  donPatchElf = true;
+  dontStrip = true;
+
+  inherit passthru;
+
+  meta = with lib; {
+    homepage = "http://pypy.org/";
+    description = "Fast, compliant alternative implementation of the Python language (${pythonVersion})";
+    license = licenses.mit;
+    platforms = [ "x86_64-linux" ];
+  };
+
+}