1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 pythonOlder,
7 rapidjson,
8 pytestCheckHook,
9 pytz,
10 setuptools,
11 substituteAll,
12}:
13
14let
15 rapidjson' = rapidjson.overrideAttrs (old: {
16 version = "unstable-2023-03-06";
17 src = fetchFromGitHub {
18 owner = "Tencent";
19 repo = "rapidjson";
20 rev = "5e17dbed34eef33af8f3e734820b5dc547a2a3aa";
21 hash = "sha256-CTy42X6P6+Gz4WbJ3tCpAw3qqlJ+mU1PaWW9LGG+6nU=";
22 };
23 patches = [
24 (fetchpatch {
25 name = "do-not-include-gtest-src-dir.patch";
26 url = "https://git.alpinelinux.org/aports/plain/community/rapidjson/do-not-include-gtest-src-dir.patch?id=9e5eefc7a5fcf5938a8dc8a3be8c75e9e6809909";
27 hash = "sha256-BjSZEwfCXA/9V+kxQ/2JPWbc26jQn35CfN8+8NW24s4=";
28 })
29 ];
30 });
31in
32buildPythonPackage rec {
33 version = "1.18";
34 pname = "python-rapidjson";
35 disabled = pythonOlder "3.8";
36
37 pyproject = true;
38
39 src = fetchFromGitHub {
40 owner = "python-rapidjson";
41 repo = "python-rapidjson";
42 rev = "refs/tags/v${version}";
43 hash = "sha256-4gJm6EnT6YNg+EkkBPiPQ4TBGG/u+FZTK4bKWyqw1pM=";
44 };
45
46 patches = [
47 (substituteAll {
48 src = ./rapidjson-include-dir.patch;
49 rapidjson = lib.getDev rapidjson';
50 })
51 ];
52
53 build-system = [ setuptools ];
54
55 nativeCheckInputs = [
56 pytestCheckHook
57 pytz
58 ];
59
60 disabledTestPaths = [ "benchmarks" ];
61
62 meta = with lib; {
63 changelog = "https://github.com/python-rapidjson/python-rapidjson/blob/${src.rev}/CHANGES.rst";
64 homepage = "https://github.com/python-rapidjson/python-rapidjson";
65 description = "Python wrapper around rapidjson";
66 license = licenses.mit;
67 maintainers = with maintainers; [ dotlambda ];
68 };
69}