summary refs log tree commit diff
path: root/pkgs/development/interpreters/python
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2022-01-15 18:01:07 +0000
committerGitHub <noreply@github.com>2022-01-15 18:01:07 +0000
commited9751296d80bb633b6ebbccd691a6e8f65e0d06 (patch)
tree7fd3c2e8852780063cad816c3c4fb87a8180bf27 /pkgs/development/interpreters/python
parent6d8719a23dbea749e6ebc5f74190dbb6c58c427b (diff)
parent9f7f16789c729baf0ffd88c524a4bf50c716ae8f (diff)
downloadnixpkgs-ed9751296d80bb633b6ebbccd691a6e8f65e0d06.tar
nixpkgs-ed9751296d80bb633b6ebbccd691a6e8f65e0d06.tar.gz
nixpkgs-ed9751296d80bb633b6ebbccd691a6e8f65e0d06.tar.bz2
nixpkgs-ed9751296d80bb633b6ebbccd691a6e8f65e0d06.tar.lz
nixpkgs-ed9751296d80bb633b6ebbccd691a6e8f65e0d06.tar.xz
nixpkgs-ed9751296d80bb633b6ebbccd691a6e8f65e0d06.tar.zst
nixpkgs-ed9751296d80bb633b6ebbccd691a6e8f65e0d06.zip
Merge master into staging-next
Diffstat (limited to 'pkgs/development/interpreters/python')
-rw-r--r--pkgs/development/interpreters/python/default.nix16
-rw-r--r--pkgs/development/interpreters/python/pypy/prebuilt.nix20
-rw-r--r--pkgs/development/interpreters/python/pypy/prebuilt_2_7.nix132
3 files changed, 151 insertions, 17 deletions
diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix
index 852a11594ef..5cdba9d3204 100644
--- a/pkgs/development/interpreters/python/default.nix
+++ b/pkgs/development/interpreters/python/default.nix
@@ -274,29 +274,29 @@ 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;
   };
 
-  pypy36_prebuilt = callPackage ./pypy/prebuilt.nix {
+  pypy38_prebuilt = callPackage ./pypy/prebuilt.nix {
     # Not included at top-level
-    self = pythonInterpreters.pypy36_prebuilt;
+    self = pythonInterpreters.pypy38_prebuilt;
     sourceVersion = {
       major = "7";
       minor = "3";
-      patch = "3";
+      patch = "7";
     };
-    sha256 = "02lys9bjky9bqg6ggv8djirbd3zzcsq7755v4yvwm0k4a7fmzf2g"; # linux64
-    pythonVersion = "3.6";
+    sha256 = "sha256-Xe43x8PLixYAKPveOlkBxoBD36VFoWeUUCuJfUvEDX4="; # linux64
+    pythonVersion = "3.8";
     inherit passthruFun;
   };
 
diff --git a/pkgs/development/interpreters/python/pypy/prebuilt.nix b/pkgs/development/interpreters/python/pypy/prebuilt.nix
index 460af1cc67b..69de6e94e37 100644
--- a/pkgs/development/interpreters/python/pypy/prebuilt.nix
+++ b/pkgs/development/interpreters/python/pypy/prebuilt.nix
@@ -6,8 +6,9 @@
 , which
 # Dependencies
 , bzip2
+, sqlite
 , zlib
-, openssl_1_0_2
+, openssl
 , expat
 , ncurses6
 , tcl-8_5
@@ -27,12 +28,12 @@ with lib;
 
 let
   isPy3k = majorVersion == "3";
-  passthru = passthruFun {
+  passthru = passthruFun rec {
     inherit self sourceVersion pythonVersion packageOverrides;
     implementation = "pypy";
     libPrefix = "pypy${pythonVersion}";
     executable = "pypy${if isPy3k then "3" else ""}";
-    sitePackages = "site-packages";
+    sitePackages = "lib/${libPrefix}/site-packages";
     hasDistutilsCxxPatch = false;
 
     # Not possible to cross-compile with.
@@ -49,8 +50,9 @@ let
 
   deps = [
     bzip2
+    sqlite
     zlib
-    openssl_1_0_2
+    openssl
     expat
     ncurses6
     tcl-8_5
@@ -68,10 +70,9 @@ in with passthru; stdenv.mkDerivation {
   buildInputs = [ which ];
 
   installPhase = ''
-    mkdir -p $out/lib
+    mkdir -p $out
     echo "Moving files to $out"
-    mv -t $out bin include lib-python lib_pypy site-packages
-    mv lib/libffi.so.6* $out/lib/
+    mv -t $out bin include lib
 
     mv $out/bin/libpypy*-c.so $out/lib/
 
@@ -84,8 +85,9 @@ in with passthru; stdenv.mkDerivation {
              $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 {} \;
+
+    find ./lib -name "*.so" -exec patchelf --remove-needed libncursesw.so.6 --replace-needed libtinfow.so.6 libncursesw.so.6 {} \;
+    find ./lib -name "*.so" -exec patchelf --set-rpath ${lib.makeLibraryPath deps}:$out/lib {} \;
 
     echo "Removing bytecode"
     find . -name "__pycache__" -type d -depth -exec rm -rf {} \;
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" ];
+  };
+
+}