Unverified Commit cb60862b authored by Arne Keller's avatar Arne Keller Committed by GitHub
Browse files

electron-cash: 4.3.1 -> 4.4.2, fix build and tests (#376281)

parents 107f72ad cf28b966
Loading
Loading
Loading
Loading
+39 −22
Original line number Diff line number Diff line
{ lib, stdenv, fetchFromGitHub, python3Packages, wrapQtAppsHook
, secp256k1, qtwayland }:
{
  lib,
  stdenv,
  fetchFromGitHub,
  python3Packages,
  qt5,
  secp256k1,
}:

python3Packages.buildPythonApplication rec {
  pname = "electron-cash";
  version = "4.3.1";
  version = "4.4.2";

  src = fetchFromGitHub {
    owner = "Electron-Cash";
    repo = "Electron-Cash";
    tag = version;
    sha256 = "sha256-xOyj5XerOwgfvI0qj7+7oshDvd18h5IeZvcJTis8nWo=";
    sha256 = "sha256-hqaPxetS6JONvlRMjNonXUGFpdmnuadD00gcPzY07x0=";
  };

  build-system = with python3Packages; [
@@ -38,6 +44,7 @@ python3Packages.buildPythonApplication rec {
    psutil
    pycryptodomex
    cryptography
    zxing-cpp

    # requirements-hw
    trezor
@@ -49,36 +56,42 @@ python3Packages.buildPythonApplication rec {
    pysatochip
  ];

  nativeBuildInputs = [ wrapQtAppsHook ];
  nativeBuildInputs = [ qt5.wrapQtAppsHook ];

  buildInputs = [ ] ++ lib.optional stdenv.hostPlatform.isLinux qtwayland;

  postPatch = ''
    substituteInPlace contrib/requirements/requirements.txt \
      --replace "qdarkstyle==2.6.8" "qdarkstyle<3"

    substituteInPlace setup.py \
      --replace "(share_dir" "(\"share\""
  '';
  buildInputs = [ ] ++ lib.optional stdenv.hostPlatform.isLinux qt5.qtwayland;

  # If secp256k1 wasn't added to the library path, the following warning is given:
  #
  #   Electron Cash was unable to find the secp256k1 library on this system.
  #   Elliptic curve cryptography operations will be performed in slow
  #   Python-only mode.
  #
  # Upstream hardcoded `libsecp256k1.so.0` where we provides
  # `libsecp256k1.so.5`. The only breaking change is the removal of two
  # functions which seem not used by electron-cash.
  # See: <https://github.com/Electron-Cash/Electron-Cash/issues/3009>
  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail "(share_dir" '("share"'
    substituteInPlace electroncash/secp256k1.py \
      --replace-fail "libsecp256k1.so.0" "${secp256k1}/lib/libsecp256k1.so.5"
  '';

  preFixup = ''
    makeWrapperArgs+=("''${qtWrapperArgs[@]}")
    makeWrapperArgs+=(
      "--prefix" "LD_LIBRARY_PATH" ":" "${secp256k1}/lib"
    )
  '';

  doInstallCheck = true;
  installCheckPhase = ''
    $out/bin/electron-cash help >/dev/null
    output="$($out/bin/electron-cash help 2>&1)"
    if [[ "$output" == *"failed to load"* ]]; then
      echo "$output"
      echo "Forbidden text detected: failed to load"
      exit 1
    fi
  '';

  meta = with lib; {
  meta = {
    description = "Bitcoin Cash SPV Wallet";
    mainProgram = "electron-cash";
    longDescription = ''
@@ -88,8 +101,12 @@ python3Packages.buildPythonApplication rec {
      of the blockchain.
    '';
    homepage = "https://www.electroncash.org/";
    platforms = platforms.unix;
    maintainers = with maintainers; [ lassulus nyanloutre oxalica ];
    license = licenses.mit;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [
      lassulus
      nyanloutre
      oxalica
    ];
    license = lib.licenses.mit;
  };
}
+0 −2
Original line number Diff line number Diff line
@@ -13109,8 +13109,6 @@ with pkgs;
    inherit (darwin.apple_sdk.frameworks) AppKit;
  };
  electron-cash = libsForQt5.callPackage ../applications/misc/electron-cash { };
  electrum = libsForQt5.callPackage ../applications/misc/electrum { };
  electrum-grs = libsForQt5.callPackage ../applications/misc/electrum/grs.nix { };