1{ stdenv
2, lib
3, buildPythonPackage
4, cargo
5, cffi
6, fetchPypi
7, glean-parser
8, iso8601
9, lmdb
10, pkg-config
11, pytest-localserver
12, pytestCheckHook
13, python
14, pythonOlder
15, rustc
16, rustPlatform
17, semver
18, setuptools-rust
19}:
20
21buildPythonPackage rec {
22 pname = "glean-sdk";
23 version = "52.7.0";
24
25 disabled = pythonOlder "3.6";
26
27 src = fetchPypi {
28 inherit pname version;
29 hash = "sha256-sLjdGHiS7Co/oA9gQyAFkD14tAYjmwjWcPr4CRrzw/0=";
30 };
31
32 cargoDeps = rustPlatform.fetchCargoTarball {
33 inherit src;
34 name = "${pname}-${version}";
35 hash = "sha256-5TlgWcLmjklxhtDbB0aRF71iIRTJwetFj1Jii1DGdvU=";
36 };
37
38 nativeBuildInputs = [
39 cargo
40 pkg-config
41 rustc
42 rustPlatform.cargoSetupHook
43 setuptools-rust
44 ];
45
46 buildInputs = [
47 lmdb
48 ];
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.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf) ''
69 readelf -a $out/${python.sitePackages}/glean/libglean_ffi.so | grep -F 'Shared library: [liblmdb.so'
70 '';
71
72 pythonImportsCheck = [
73 "glean"
74 ];
75
76 meta = with lib; {
77 broken = stdenv.isDarwin;
78 description = "Telemetry client libraries and are a part of the Glean project";
79 homepage = "https://mozilla.github.io/glean/book/index.html";
80 license = licenses.mpl20;
81 maintainers = with maintainers; [ melling ];
82 };
83}