xref: /aosp_15_r20/external/pigweed/pw_rpc/py/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2021 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/python.gni")
18import("$dir_pw_build/python_action_test.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_rpc/internal/integration_test_ports.gni")
21
22pw_python_package("py") {
23  generate_setup = {
24    metadata = {
25      name = "pw_rpc"
26      version = "0.0.1"
27    }
28    options = {
29      install_requires = [
30        "protobuf",
31        "pyserial",
32      ]
33    }
34  }
35
36  sources = [
37    "pw_rpc/__init__.py",
38    "pw_rpc/callback_client/__init__.py",
39    "pw_rpc/callback_client/call.py",
40    "pw_rpc/callback_client/errors.py",
41    "pw_rpc/callback_client/impl.py",
42    "pw_rpc/client.py",
43    "pw_rpc/client_utils.py",
44    "pw_rpc/codegen.py",
45    "pw_rpc/codegen_nanopb.py",
46    "pw_rpc/codegen_pwpb.py",
47    "pw_rpc/codegen_raw.py",
48    "pw_rpc/console_tools/__init__.py",
49    "pw_rpc/console_tools/console.py",
50    "pw_rpc/console_tools/functions.py",
51    "pw_rpc/console_tools/watchdog.py",
52    "pw_rpc/descriptors.py",
53    "pw_rpc/ids.py",
54    "pw_rpc/lossy_channel.py",
55    "pw_rpc/packets.py",
56    "pw_rpc/plugin.py",
57    "pw_rpc/plugin_nanopb.py",
58    "pw_rpc/plugin_pwpb.py",
59    "pw_rpc/plugin_raw.py",
60    "pw_rpc/testing.py",
61  ]
62  tests = [
63    "tests/callback_client_test.py",
64    "tests/client_test.py",
65    "tests/console_tools/console_tools_test.py",
66    "tests/console_tools/functions_test.py",
67    "tests/console_tools/watchdog_test.py",
68    "tests/descriptors_test.py",
69    "tests/ids_test.py",
70    "tests/packets_test.py",
71  ]
72  python_deps = [
73    "$dir_pw_protobuf/py",
74    "$dir_pw_protobuf_compiler/py",
75    "$dir_pw_status/py",
76    "$dir_pw_stream/py",
77  ]
78  python_test_deps = [
79    "$dir_pw_build/py",
80    "$dir_pw_log:protos.python",
81    "$dir_pw_tokenizer/py:test_proto.python",
82  ]
83  pylintrc = "$dir_pigweed/.pylintrc"
84  mypy_ini = "$dir_pigweed/.mypy.ini"
85  ruff_toml = "$dir_pigweed/.ruff.toml"
86  proto_library = "..:protos"
87}
88
89pw_doc_group("docs") {
90  sources = [ "docs.rst" ]
91  other_deps = [ ":py" ]
92}
93
94pw_python_action_test("python_client_cpp_server_test") {
95  sources = [ "tests/python_client_cpp_server_test.py" ]
96  python_deps = [
97    ":py",
98    "$dir_pw_build/py",
99    "$dir_pw_hdlc/py",
100    "$dir_pw_log:protos.python",
101    "$dir_pw_status/py",
102    "$dir_pw_tokenizer/py:test_proto.python",
103  ]
104  args = [
105    "--port=$pw_rpc_PYTHON_CLIENT_CPP_SERVER_TEST_PORT",
106    "--test-server-command",
107    "<TARGET_FILE(..:test_rpc_server)>",
108  ]
109  deps = [ "..:test_rpc_server" ]
110  tags = [ "integration" ]
111}
112