1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 cargo,
6 cffi,
7 fetchPypi,
8 glean-parser,
9 iso8601,
10 lmdb,
11 pkg-config,
12 pytest-localserver,
13 pytestCheckHook,
14 python,
15 pythonOlder,
16 rustc,
17 rustPlatform,
18 semver,
19 setuptools-rust,
20}:
21
22buildPythonPackage rec {
23 pname = "glean-sdk";
24 version = "52.7.0";
25 format = "setuptools";
26
27 disabled = pythonOlder "3.6";
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-sLjdGHiS7Co/oA9gQyAFkD14tAYjmwjWcPr4CRrzw/0=";
32 };
33
34 cargoDeps = rustPlatform.fetchCargoTarball {
35 inherit src;
36 name = "${pname}-${version}";
37 hash = "sha256-5TlgWcLmjklxhtDbB0aRF71iIRTJwetFj1Jii1DGdvU=";
38 };
39
40 nativeBuildInputs = [
41 cargo
42 pkg-config
43 rustc
44 rustPlatform.cargoSetupHook
45 setuptools-rust
46 ];
47
48 buildInputs = [ lmdb ];
49
50 propagatedBuildInputs = [
51 cffi
52 glean-parser
53 iso8601
54 semver
55 ];
56
57 nativeCheckInputs = [
58 pytest-localserver
59 pytestCheckHook
60 ];
61
62 disabledTests = [
63 # RuntimeError: No ping received.
64 "test_client_activity_api"
65 "test_flipping_upload_enabled_respects_order_of_events"
66 ];
67
68 postInstallCheck = lib.optionalString stdenv.hostPlatform.isElf ''
69 readelf -a $out/${python.sitePackages}/glean/libglean_ffi.so | grep -F 'Shared library: [liblmdb.so'
70 '';
71
72 pythonImportsCheck = [ "glean" ];
73
74 meta = with lib; {
75 broken = stdenv.isDarwin;
76 description = "Telemetry client libraries and are a part of the Glean project";
77 homepage = "https://mozilla.github.io/glean/book/index.html";
78 license = licenses.mpl20;
79 maintainers = with maintainers; [ melling ];
80 };
81}