summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/rencode/default.nix
blob: 46183f602ac900665a1a2d167aaceb35c287b396 (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  cython,
  poetry-core,
  setuptools,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "rencode";
  version = "1.0.8";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "aresch";
    repo = "rencode";
    tag = "v${version}";
    hash = "sha256-k2b6DoKwNeQBkmqSRXqaRTjK7CVX6IKuXCLG9lBdLLY=";
  };

  patches = [
    # backport fix for -msse being passed on aarch64-linux
    (fetchpatch {
      url = "https://github.com/aresch/rencode/commit/591b9f4d85d7e2d4f4e99441475ef15366389be2.patch";
      hash = "sha256-KhfawtYa4CnYiVzBYdtMn/JRkeqCLJetHvLEm1YVOe4=";
    })
    # do not pass -march=native etc. on x86_64
    (fetchpatch {
      url = "https://github.com/aresch/rencode/commit/e7ec8ea718e73a8fee7dbc007c262e1584f7f94b.patch";
      hash = "sha256-gNYjxBsMN1p4IAmutV73JF8yCj0iz3DIl7kg7WrBdbs=";
    })
  ];

  nativeBuildInputs = [
    poetry-core
    setuptools
    cython
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  preCheck = ''
    # import from $out
    rm -r rencode
  '';

  meta = {
    homepage = "https://github.com/aresch/rencode";
    description = "Fast (basic) object serialization similar to bencode";
    license = lib.licenses.gpl3Plus;
    maintainers = [ ];
  };
}