Commit 849dc914 authored by Martin Joerg's avatar Martin Joerg
Browse files

magic-wormhole-mailbox-server: adopt, switch to pyproject, disable for Python 3.12

parent 95c85aaf
Loading
Loading
Loading
Loading
+20 −19
Original line number Diff line number Diff line
@@ -3,27 +3,29 @@
, buildPythonPackage
, fetchPypi
, fetchpatch
, setuptools
, six
, attrs
, twisted
, pyopenssl
, service-identity
, autobahn
, treq
, mock
, pythonOlder
, pythonAtLeast
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "magic-wormhole-mailbox-server";
  version = "0.4.1";
  format = "setuptools";
  pyproject = true;

  disabled = pythonOlder "3.7";
  # python 3.12 support: https://github.com/magic-wormhole/magic-wormhole-mailbox-server/issues/41
  disabled = pythonOlder "3.7" || pythonAtLeast "3.12";

  src = fetchPypi {
    inherit pname version;
    sha256 = "1af10592909caaf519c00e706eac842c5e77f8d4356215fe9c61c7b2258a88fb";
    hash = "sha256-GvEFkpCcqvUZwA5wbqyELF53+NQ1YhX+nGHHsiWKiPs=";
  };

  patches = [
@@ -35,6 +37,8 @@ buildPythonPackage rec {
    })
  ];

  nativeBuildInputs = [ setuptools ];

  propagatedBuildInputs = [
    attrs
    six
@@ -43,27 +47,24 @@ buildPythonPackage rec {
  ] ++ autobahn.optional-dependencies.twisted
  ++ twisted.optional-dependencies.tls;

  pythonImportsCheck = [ "wormhole_mailbox_server" ];

  nativeCheckInputs = [
    pytestCheckHook
    treq
    mock
    twisted
  ];

  # Fails in Darwin's sandbox
  postPatch = lib.optionalString stdenv.isDarwin ''
    echo 'LogRequests.skip = "Operation not permitted"' >> src/wormhole_mailbox_server/test/test_web.py
    echo 'WebSocketAPI.skip = "Operation not permitted"' >> src/wormhole_mailbox_server/test/test_web.py
  '';

  checkPhase = ''
    trial -j$NIX_BUILD_CORES wormhole_mailbox_server
  '';
  disabledTestPaths = lib.optionals stdenv.isDarwin [
    # these tests fail in Darwin's sandbox
    "src/wormhole_mailbox_server/test/test_web.py"
  ];

  meta = with lib; {
  meta = {
    description = "Securely transfer data between computers";
    homepage = "https://github.com/warner/magic-wormhole-mailbox-server";
    homepage = "https://github.com/magic-wormhole/magic-wormhole-mailbox-server";
    changelog = "https://github.com/magic-wormhole/magic-wormhole-mailbox-server/blob/${version}/NEWS.md";
    license = licenses.mit;
    maintainers = with maintainers; [ ];
    license = lib.licenses.mit;
    maintainers = [ lib.maintainers.mjoerg ];
  };
}