about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorThiago Kenji Okada <thiagokokada@gmail.com>2023-01-07 21:51:59 +0000
committerGitHub <noreply@github.com>2023-01-07 21:51:59 +0000
commit9a21e9a450d11044e224bfd84d4a50914f6953a6 (patch)
tree8f62638eb911d68eb8663f26a58d88e2c3c8fc59 /pkgs
parentda3aa835878a53d5c598fc7b0e7016c65980f08c (diff)
parentaa0c474f4bf0d177ca79b05655bc0484c8a3c463 (diff)
Merge pull request #209100 from thiagokokada/bump-pypy
pypy{27,38,39}: 7.3.9 -> 7.3.11
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/interpreters/python/default.nix34
-rw-r--r--pkgs/development/interpreters/python/pypy/default.nix5
-rw-r--r--pkgs/development/interpreters/python/pypy/prebuilt.nix58
-rw-r--r--pkgs/development/interpreters/python/pypy/prebuilt_2_7.nix81
-rw-r--r--pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch8
5 files changed, 104 insertions, 82 deletions
diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix
index 4040223221ea5..f48bc87b55abc 100644
--- a/pkgs/development/interpreters/python/default.nix
+++ b/pkgs/development/interpreters/python/default.nix
@@ -247,13 +247,13 @@ in {
     sourceVersion = {
       major = "7";
       minor = "3";
-      patch = "9";
+      patch = "11";
     };
 
-    sha256 = "sha256-ObCXKVb2VIzlgoAZ264SUDwy1svpGivs+I0+QsxSGXs=";
+    sha256 = "sha256-ERevtmgx2k6m852NIIR4enRon9AineC+MB+e2bJVCTw=";
     pythonVersion = "2.7";
     db = db.override { dbmSupport = !stdenv.isDarwin; };
-    python = __splicedPackages.python27;
+    python = __splicedPackages.pythonInterpreters.pypy27_prebuilt;
     inherit passthruFun;
     inherit (darwin) libunwind;
     inherit (darwin.apple_sdk.frameworks) Security;
@@ -264,13 +264,13 @@ in {
     sourceVersion = {
       major = "7";
       minor = "3";
-      patch = "9";
+      patch = "11";
     };
 
-    sha256 = "sha256-Krqh6f4ewOIzyfvDd6DI6aBjQICo9PMOtomDAfZhjBI=";
+    sha256 = "sha256-sPMWb7Klqt/VzrnbXN1feSmg7MygK0omwNrgSS98qOo=";
     pythonVersion = "3.9";
     db = db.override { dbmSupport = !stdenv.isDarwin; };
-    python = __splicedPackages.python27;
+    python = __splicedPackages.pypy27;
     inherit passthruFun;
     inherit (darwin) libunwind;
     inherit (darwin.apple_sdk.frameworks) Security;
@@ -279,24 +279,26 @@ in {
   pypy38 = __splicedPackages.pypy39.override {
     self = __splicedPackages.pythonInterpreters.pypy38;
     pythonVersion = "3.8";
-    sha256 = "sha256-W12dklbxKhKa+DhOL1gb36s7wPu+OgpIDZwdLpVJDrE=";
-  };
-  pypy37 = __splicedPackages.pypy39.override {
-    self = __splicedPackages.pythonInterpreters.pypy37;
-    pythonVersion = "3.7";
-    sha256 = "sha256-cEJhY7GU7kYAmYbuptlCYJij/7VS2c29PfqmSkc3P0k=";
+    sha256 = "sha256-TWdpv8pzc06GZv1wUDt86wam4lkRDmFzMbs4mcpOYFg=";
   };
 
+  pypy37 = throw "pypy37 has been removed from nixpkgs since it is no longer supported upstream"; # Added 2023-01-04
+
   pypy27_prebuilt = callPackage ./pypy/prebuilt_2_7.nix {
     # Not included at top-level
     self = __splicedPackages.pythonInterpreters.pypy27_prebuilt;
     sourceVersion = {
       major = "7";
       minor = "3";
-      patch = "9";
+      patch = "11";
     };
 
-    sha256 = "sha256-FyqSiwCWp+ALfVj1I/VzAMNcPef4IkkeKnvIRTdcI/g="; # linux64
+    sha256 = {
+      aarch64-linux = "sha256-6pJNod7+kyXvdg4oiwT5hGFOQFWA9TIetqXI9Tm9QVo=";
+      x86_64-linux = "sha256-uo7ZWKkFwHNaTP/yh1wlCJlU3AIOCH2YKw/6W52jFs0=";
+      aarch64-darwin = "sha256-zFaWq0+TzTSBweSZC13t17pgrAYC+hiQ02iImmxb93E=";
+      x86_64-darwin = "sha256-Vt7unCJkD1aGw1udZP2xzjq9BEWD5AePCxccov0qGY4=";
+    }.${stdenv.system};
     pythonVersion = "2.7";
     inherit passthruFun;
   };
@@ -307,9 +309,9 @@ in {
     sourceVersion = {
       major = "7";
       minor = "3";
-      patch = "9";
+      patch = "11";
     };
-    sha256 = "sha256-RoGMs9dLlrNHh1SDQ9Jm4lYrUx3brzMDg7qTD/GTDtU="; # linux64
+    sha256 = "sha256-1QYXLKEQcSdBdddOnFgcMWZDLQF5sDZHDjuejSDq5YE="; # linux64
     pythonVersion = "3.9";
     inherit passthruFun;
   };
diff --git a/pkgs/development/interpreters/python/pypy/default.nix b/pkgs/development/interpreters/python/pypy/default.nix
index 0c3b73e9fd5b7..801099dd44b34 100644
--- a/pkgs/development/interpreters/python/pypy/default.nix
+++ b/pkgs/development/interpreters/python/pypy/default.nix
@@ -156,7 +156,7 @@ in with passthru; stdenv.mkDerivation rec {
     ln -s $out/${executable}-c/lib-python/${if isPy3k then "3" else pythonVersion} $out/lib/${libPrefix}
 
     ${lib.optionalString stdenv.isDarwin ''
-      install_name_tool -change @rpath/libpypy${optionalString isPy3k "3"}-c.dylib $out/lib/libpypy${optionalString isPy3k "3"}-c.dylib $out/bin/${executable}
+      install_name_tool -change @rpath/lib${executable}-c.dylib $out/lib/lib${executable}-c.dylib $out/bin/${executable}
     ''}
 
     # verify cffi modules
@@ -173,7 +173,8 @@ in with passthru; stdenv.mkDerivation rec {
     homepage = "http://pypy.org/";
     description = "Fast, compliant alternative implementation of the Python language (${pythonVersion})";
     license = licenses.mit;
-    platforms = [ "aarch64-linux" "i686-linux" "x86_64-linux" "x86_64-darwin" ];
+    platforms = [ "aarch64-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];
+    broken = stdenv.isDarwin && stdenv.isAarch64;
     maintainers = with maintainers; [ andersk ];
   };
 }
diff --git a/pkgs/development/interpreters/python/pypy/prebuilt.nix b/pkgs/development/interpreters/python/pypy/prebuilt.nix
index 69de6e94e3781..7c5d94f474450 100644
--- a/pkgs/development/interpreters/python/pypy/prebuilt.nix
+++ b/pkgs/development/interpreters/python/pypy/prebuilt.nix
@@ -1,18 +1,18 @@
 { lib
 , stdenv
 , fetchurl
+, autoPatchelfHook
 , python-setup-hook
 , self
-, which
 # Dependencies
 , bzip2
-, sqlite
-, zlib
-, openssl
 , expat
+, gdbm
 , ncurses6
+, sqlite
 , tcl-8_5
 , tk-8_5
+, zlib
 # For the Python package set
 , packageOverrides ? (self: super: {})
 , sourceVersion
@@ -46,18 +46,7 @@ let
   pname = "${passthru.executable}_prebuilt";
   version = with sourceVersion; "${major}.${minor}.${patch}";
 
-  majorVersion = substring 0 1 pythonVersion;
-
-  deps = [
-    bzip2
-    sqlite
-    zlib
-    openssl
-    expat
-    ncurses6
-    tcl-8_5
-    tk-8_5
-  ];
+  majorVersion = lib.versions.major pythonVersion;
 
 in with passthru; stdenv.mkDerivation {
   inherit pname version;
@@ -67,9 +56,22 @@ in with passthru; stdenv.mkDerivation {
     inherit sha256;
   };
 
-  buildInputs = [ which ];
+  buildInputs = [
+    bzip2
+    expat
+    gdbm
+    ncurses6
+    sqlite
+    tcl-8_5
+    tk-8_5
+    zlib
+  ];
+
+  nativeBuildInputs = [ autoPatchelfHook ];
 
   installPhase = ''
+    runHook preInstall
+
     mkdir -p $out
     echo "Moving files to $out"
     mv -t $out bin include lib
@@ -78,24 +80,20 @@ in with passthru; stdenv.mkDerivation {
 
     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 -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 {} \;
-    popd
+    find . -name "__pycache__" -type d -depth -delete
 
     # Include a sitecustomize.py file
     cp ${../sitecustomize.py} $out/${sitePackages}/sitecustomize.py
 
+    runHook postInstall
+  '';
+
+  preFixup = ''
+    find $out/{lib,lib_pypy*} -name "*.so" \
+      -exec patchelf \
+        --replace-needed libtinfow.so.6 libncursesw.so.6 \
+        --replace-needed libgdbm.so.4 libgdbm_compat.so.4 {} \;
   '';
 
   doInstallCheck = true;
diff --git a/pkgs/development/interpreters/python/pypy/prebuilt_2_7.nix b/pkgs/development/interpreters/python/pypy/prebuilt_2_7.nix
index 877a00efa4832..444d43309511a 100644
--- a/pkgs/development/interpreters/python/pypy/prebuilt_2_7.nix
+++ b/pkgs/development/interpreters/python/pypy/prebuilt_2_7.nix
@@ -1,16 +1,18 @@
 { lib
 , stdenv
 , fetchurl
+, autoPatchelfHook
 , python-setup-hook
 , self
-, which
 # Dependencies
 , bzip2
-, zlib
 , expat
+, gdbm
 , ncurses6
+, sqlite
 , tcl-8_5
 , tk-8_5
+, zlib
 # For the Python package set
 , packageOverrides ? (self: super: {})
 , sourceVersion
@@ -44,57 +46,72 @@ let
   pname = "${passthru.executable}_prebuilt";
   version = with sourceVersion; "${major}.${minor}.${patch}";
 
-  majorVersion = substring 0 1 pythonVersion;
+  majorVersion = lib.versions.major pythonVersion;
 
-  deps = [
-    bzip2
-    zlib
-    expat
-    ncurses6
-    tcl-8_5
-    tk-8_5
-  ];
+  downloadUrls = {
+    aarch64-linux = "https://downloads.python.org/pypy/pypy${pythonVersion}-v${version}-aarch64.tar.bz2";
+    x86_64-linux = "https://downloads.python.org/pypy/pypy${pythonVersion}-v${version}-linux64.tar.bz2";
+    aarch64-darwin = "https://downloads.python.org/pypy/pypy${pythonVersion}-v${version}-macos_arm64.tar.bz2";
+    x86_64-darwin = "https://downloads.python.org/pypy/pypy${pythonVersion}-v${version}-macos_x86_64.tar.bz2";
+  };
 
 in with passthru; stdenv.mkDerivation {
   inherit pname version;
 
   src = fetchurl {
-    url = "https://downloads.python.org/pypy/pypy${pythonVersion}-v${version}-linux64.tar.bz2";
+    url = downloadUrls.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
     inherit sha256;
   };
 
-  buildInputs = [ which ];
+  buildInputs = [
+    bzip2
+    expat
+    gdbm
+    ncurses6
+    sqlite
+    tcl-8_5
+    tk-8_5
+    zlib
+  ];
+
+  nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
 
   installPhase = ''
+    runHook preInstall
+
     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 {} \;
+    mv $out/bin/libpypy*-c${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/
+    ${lib.optionalString stdenv.isLinux ''
+      mv lib/libffi.so.6* $out/lib/
+      rm $out/bin/*.debug
+    ''}
 
     echo "Removing bytecode"
-    find . -name "__pycache__" -type d -depth -exec rm -rf {} \;
-    popd
+    find . -name "__pycache__" -type d -depth -delete
 
     # Include a sitecustomize.py file
     cp ${../sitecustomize.py} $out/${sitePackages}/sitecustomize.py
 
+    runHook postInstall
+  '';
+
+  preFixup = lib.optionalString (stdenv.isLinux) ''
+    find $out/{lib,lib_pypy*} -name "*.so" \
+      -exec patchelf \
+        --replace-needed libtinfow.so.6 libncursesw.so.6 \
+        --replace-needed libgdbm.so.4 libgdbm_compat.so.4 {} \;
+  '' + lib.optionalString (stdenv.isDarwin) ''
+    install_name_tool \
+      -change \
+        @rpath/lib${executable}-c.dylib \
+        $out/lib/lib${executable}-c.dylib \
+        $out/bin/${executable}
   '';
 
-  doInstallCheck = true;
+  # Native libraries are not working in darwin
+  doInstallCheck = !stdenv.isDarwin;
 
   # Check whether importing of (extension) modules functions
   installCheckPhase = let
@@ -124,7 +141,7 @@ in with passthru; stdenv.mkDerivation {
     homepage = "http://pypy.org/";
     description = "Fast, compliant alternative implementation of the Python language (${pythonVersion})";
     license = licenses.mit;
-    platforms = [ "x86_64-linux" ];
+    platforms = lib.mapAttrsToList (arch: _: arch) downloadUrls;
   };
 
 }
diff --git a/pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch b/pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch
index 15d03830e07eb..cf1bcddeba6b7 100644
--- a/pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch
+++ b/pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch
@@ -1,14 +1,18 @@
 --- a/lib_pypy/_tkinter/tklib_build.py
 +++ b/lib_pypy/_tkinter/tklib_build.py
-@@ -17,19 +17,14 @@ elif sys.platform == 'win32':
+@@ -17,23 +17,14 @@ elif sys.platform == 'win32':
      incdirs = []
      linklibs = ['tcl85', 'tk85']
      libdirs = []
 -elif sys.platform == 'darwin':
 -    # homebrew
+-    homebrew = os.environ.get('HOMEBREW_PREFIX', '')
 -    incdirs = ['/usr/local/opt/tcl-tk/include']
 -    linklibs = ['tcl8.6', 'tk8.6']
--    libdirs = ['/usr/local/opt/tcl-tk/lib']
+-    libdirs = []
+-    if homebrew:
+-        incdirs.append(homebrew + '/include')
+-        libdirs.append(homebrew + '/opt/tcl-tk/lib')
  else:
      # On some Linux distributions, the tcl and tk libraries are
      # stored in /usr/include, so we must check this case also