about summary refs log tree commit diff
path: root/pkgs/development/python-modules/walrus/default.nix
blob: 976037f928893239d5ad2378b90f78fb2329510e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
  lib,
  pkgs,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,
  redis,
  unittestCheckHook,
  fetchpatch,
}:

buildPythonPackage rec {
  pname = "walrus";
  version = "0.9.3";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "coleifer";
    repo = "walrus";
    rev = "refs/tags/${version}";
    hash = "sha256-jinYMGSBAY8HTg92qU/iU5vGIrrDr5SeQG0XjsBVfcc=";
  };

  patches = [
    # distutils has been deprecated, this wraps its import inside a try-catch
    # and fallsback to a fallback import.
    # Should not be necessary in future versions.
    (fetchpatch {
      url = "https://github.com/coleifer/walrus/commit/79e20c89aa4015017ef8a3e0b5c27ca2731dc9b2.patch";
      hash = "sha256-hCpvki6SV3KYhicjjUMP4VrKMEerMjq2n1BgozXKDO8=";
    })
  ];

  propagatedBuildInputs = [ redis ];

  nativeCheckInputs = [ unittestCheckHook ];

  preCheck = ''
    ${pkgs.redis}/bin/redis-server &
    REDIS_PID=$!
  '';

  postCheck = ''
    kill $REDIS_PID
  '';

  pythonImportsCheck = [ "walrus" ];

  __darwinAllowLocalNetworking = true;

  meta = with lib; {
    description = "Lightweight Python utilities for working with Redis";
    homepage = "https://github.com/coleifer/walrus";
    changelog = "https://github.com/coleifer/walrus/blob/${version}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ mbalatsko ];
  };
}