1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPythonPackage,
6 rustPlatform,
7 cargo,
8 pkg-config,
9 rustc,
10 rustfmt,
11 setuptools-rust,
12 openssl,
13 Security,
14 msgpack,
15 fetchpatch,
16}:
17
18buildPythonPackage rec {
19 pname = "etebase";
20 version = "0.31.7";
21
22 src = fetchFromGitHub {
23 owner = "etesync";
24 repo = "etebase-py";
25 rev = "v${version}";
26 hash = "sha256-ZNUUp/0fGJxL/Rt8sAZ864rg8uCcNybIYSk4POt0vqg=";
27 };
28
29 # https://github.com/etesync/etebase-py/pull/54
30 patches = [
31 # fix python 3.12 build
32 (fetchpatch {
33 url = "https://github.com/etesync/etebase-py/commit/898eb3aca1d4eb30d4aeae15e35d0bc45dd7b3c8.patch";
34 hash = "sha256-0BDUTztiC4MiwwNEDFtfc5ruc69Qk+svepQZRixNJgA=";
35 })
36 # replace flapigen git dependency in Cargo.lock
37 (fetchpatch {
38 url = "https://github.com/etesync/etebase-py/commit/7e9e4244a144dd46383d8be950d3df79e28eb069.patch";
39 hash = "sha256-8EH8Sc3UnmuCrSwDf3+as218HiG2Ed3r+FCMrUi5YrI=";
40 })
41 ];
42
43 cargoDeps = rustPlatform.fetchCargoTarball {
44 inherit src;
45 name = "${pname}-${version}";
46 hash = "sha256-We19laZd6b2fLSPNLegyNp0eQSeCvUJeTIXqvG7o08c=";
47 inherit patches;
48 };
49
50 format = "pyproject";
51
52 nativeBuildInputs = [
53 pkg-config
54 rustfmt
55 setuptools-rust
56 rustPlatform.cargoSetupHook
57 cargo
58 rustc
59 ];
60
61 buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security ];
62
63 propagatedBuildInputs = [ msgpack ];
64
65 postPatch = ''
66 # Use system OpenSSL, which gets security updates.
67 substituteInPlace Cargo.toml \
68 --replace ', features = ["vendored"]' ""
69 '';
70
71 pythonImportsCheck = [ "etebase" ];
72
73 meta = with lib; {
74 broken = stdenv.isDarwin;
75 homepage = "https://www.etebase.com/";
76 description = "Python client library for Etebase";
77 license = licenses.bsd3;
78 maintainers = with maintainers; [ _3699n ];
79 };
80}