Unverified Commit 80a909bf authored by Pavol Rusnak's avatar Pavol Rusnak Committed by GitHub
Browse files

electrum: 4.5.8 -> 4.6.0 (#426336)

parents 8b1a4511 08eb279a
Loading
Loading
Loading
Loading
+19 −47
Original line number Diff line number Diff line
@@ -6,21 +6,12 @@
  wrapQtAppsHook,
  python3,
  zbar,
  secp256k1,
  enableQt ? true,
  callPackage,
  qtwayland,
}:

let
  libsecp256k1_name =
    if stdenv.hostPlatform.isLinux then
      "libsecp256k1.so.{v}"
    else if stdenv.hostPlatform.isDarwin then
      "libsecp256k1.{v}.dylib"
    else
      "libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}";

  libzbar_name =
    if stdenv.hostPlatform.isLinux then
      "libzbar.so.0"
@@ -28,17 +19,15 @@ let
      "libzbar.0.dylib"
    else
      "libzbar${stdenv.hostPlatform.extensions.sharedLibrary}";

in

python3.pkgs.buildPythonApplication rec {
  pname = "electrum";
  version = "4.5.8";
  version = "4.6.0";
  format = "setuptools";

  src = fetchurl {
    url = "https://download.electrum.org/${version}/Electrum-${version}.tar.gz";
    hash = "sha256-3YWVoTgTLe6Hzuds52Ch1iL8L9ZdO2rH335Tt/tup+g=";
    hash = "sha256-aQqZXyfqFgc1j2r836eaaayOmSzDijHlYXmF+OBw418=";
  };

  build-system = [ protobuf ] ++ lib.optionals enableQt [ wrapQtAppsHook ];
@@ -63,8 +52,9 @@ python3.pkgs.buildPythonApplication rec {
      requests
      certifi
      jsonpatch
      electrum-aionostr
      electrum-ecc
      # plugins
      btchip-python
      ledger-bitcoin
      ckcc-protocol
      keepkey
@@ -74,7 +64,7 @@ python3.pkgs.buildPythonApplication rec {
      pyserial
    ]
    ++ lib.optionals enableQt [
      pyqt5
      pyqt6
      qdarkstyle
    ];

@@ -85,28 +75,6 @@ python3.pkgs.buildPythonApplication rec {
    ];

  postPatch =
    ''
      # fix compatibility with recent aiorpcx version
      # (remove as soon as https://github.com/spesmilo/electrum/commit/171aa5ee5ad4e25b9da10f757d9d398e905b4945 is included in source tarball)
      substituteInPlace ./contrib/requirements/requirements.txt \
        --replace-fail "aiorpcx>=0.22.0,<0.24" "aiorpcx>=0.22.0,<0.25"
      substituteInPlace ./run_electrum \
        --replace-fail "if not ((0, 22, 0) <= aiorpcx._version < (0, 24)):" "if not ((0, 22, 0) <= aiorpcx._version < (0, 25)):" \
        --replace-fail "aiorpcX version {aiorpcx._version} does not match required: 0.22.0<=ver<0.24" "aiorpcX version {aiorpcx._version} does not match required: 0.22.0<=ver<0.25"
      substituteInPlace ./electrum/electrum \
        --replace-fail "if not ((0, 22, 0) <= aiorpcx._version < (0, 24)):" "if not ((0, 22, 0) <= aiorpcx._version < (0, 25)):" \
        --replace-fail "aiorpcX version {aiorpcx._version} does not match required: 0.22.0<=ver<0.24" "aiorpcX version {aiorpcx._version} does not match required: 0.22.0<=ver<0.25"

      # make compatible with protobuf4 by easing dependencies ...
      substituteInPlace ./contrib/requirements/requirements.txt \
        --replace-fail "protobuf>=3.20,<4" "protobuf>=3.20"
      # ... and regenerating the paymentrequest_pb2.py file
      protoc --python_out=. electrum/paymentrequest.proto

      substituteInPlace ./electrum/ecc_fast.py \
        --replace-fail ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
    ''
    + (
    if enableQt then
      ''
        substituteInPlace ./electrum/qrscanner.py \
@@ -115,8 +83,7 @@ python3.pkgs.buildPythonApplication rec {
    else
      ''
        sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt
        ''
    );
      '';

  postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
    substituteInPlace $out/share/applications/electrum.desktop \
@@ -136,6 +103,11 @@ python3.pkgs.buildPythonApplication rec {

  enabledTestPaths = [ "tests" ];

  # avoid homeless-shelter error in tests
  preCheck = ''
    export HOME="$(mktemp -d)"
  '';

  postCheck = ''
    $out/bin/electrum help >/dev/null
  '';
+3 −3
Original line number Diff line number Diff line
@@ -10,14 +10,14 @@

buildPythonPackage rec {
  pname = "aiorpcx";
  version = "0.24.0";
  version = "0.25.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "kyuupichan";
    repo = "aiorpcX";
    tag = "0.24"; # TODO: https://github.com/kyuupichan/aiorpcX/issues/52
    hash = "sha256-0c4AqKDWAmAFR1t42VE54kgbupe4ljajCR/TB5fZfME=";
    tag = version;
    hash = "sha256-mFg9mWrlnfXiQpgZ1rxvUy9TBfwy41XEKmsCf2nvxGo=";
  };

  build-system = [ setuptools ];
+52 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  setuptools,
  aiohttp,
  aiohttp-socks,
  aiorpcx,
  cryptography,
  electrum-ecc,
  click,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "electrum-aionostr";
  version = "0.0.11";
  pyproject = true;
  build-system = [ setuptools ];

  src = fetchPypi {
    pname = "electrum_aionostr";
    inherit version;
    hash = "sha256-DusdAeVdS6ssEWJolloLLBFJBlnpaf2GTEUxBFWLz4E=";
  };

  dependencies = [
    aiohttp
    aiohttp-socks
    aiorpcx
    cryptography
    electrum-ecc
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  checkInputs = [ click ];

  pythonImportsCheck = [ "electrum_aionostr" ];

  disabledTests = [
    # command line interface is broken
    "test_command_line_interface"
  ];

  meta = with lib; {
    description = "Asyncio nostr client";
    homepage = "https://github.com/spesmilo/electrum-aionostr";
    license = licenses.bsd3;
    maintainers = [ ];
  };
}
+55 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchPypi,
  setuptools,
  pkgs,
  pytestCheckHook,
}:

let
  libsecp256k1_name =
    if stdenv.hostPlatform.isLinux then
      "libsecp256k1.so.{v}"
    else if stdenv.hostPlatform.isDarwin then
      "libsecp256k1.{v}.dylib"
    else
      "libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}";
in
buildPythonPackage rec {
  pname = "electrum-ecc";
  version = "0.0.5";
  pyproject = true;
  build-system = [ setuptools ];

  src = fetchPypi {
    pname = "electrum_ecc";
    inherit version;
    hash = "sha256-9zO4WWoPeyXINx0Ir2Hvece4cdW0DwWluV0tBesvt9I=";
  };

  env = {
    # Prevent compilation of the C extension as we use the system library instead.
    ELECTRUM_ECC_DONT_COMPILE = "1";
  };

  postPatch = ''
    # remove bundled libsecp256k1
    rm -rf libsecp256k1/
    # use the system library instead
    substituteInPlace ./src/electrum_ecc/ecc_fast.py \
      --replace-fail ${libsecp256k1_name} ${pkgs.secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
  '';

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "electrum_ecc" ];

  meta = with lib; {
    description = "Pure python ctypes wrapper for libsecp256k1";
    homepage = "https://github.com/spesmilo/electrum-ecc";
    license = licenses.mit;
    maintainers = [ ];
  };
}
+5 −0
Original line number Diff line number Diff line
@@ -106,6 +106,11 @@ stdenv.mkDerivation rec {
    argp-standalone
  ];

  # fix iconv linking on macOS
  preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
    export LDFLAGS="-liconv"
  '';

  # Note: postConfigure instead of postPatch in order to include some
  # autoconf-generated files. The template files for the autogen'd scripts are
  # not chmod +x, so patchShebangs misses them.
Loading