aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWyatt Hepler <hepler@google.com>2020-10-22 08:32:13 -0700
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2020-10-22 21:12:11 +0000
commit01a85d6b0edfd976203920607f62ee338f3599b8 (patch)
tree5d1bb693af8fbaca47da3d484bdf51773f292ebe
parent0b6a5021623988f7720c266a5344de5aff0a6618 (diff)
downloadpigweed-01a85d6b0edfd976203920607f62ee338f3599b8.tar.gz
Python: Generate BUILD.gn files for Python packages
- Generate BUILD.gn files with pw_python_packages using pw_build.generate_python_package_gn. - Add the new pw_python_package targets to the default build. - Remove the unncecessary "python_packages" group. - Fix some Windows path issues in Python tests. Change-Id: I50c9b1f650652554f0836cbdc1781a00ec7e8e56 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22203 Commit-Queue: Wyatt Hepler <hepler@google.com> Reviewed-by: Rob Mohr <mohrr@google.com>
-rw-r--r--BUILD.gn39
-rw-r--r--pw_allocator/py/BUILD.gn26
-rw-r--r--pw_arduino_build/py/BUILD.gn38
-rw-r--r--pw_arduino_build/py/file_operations_test.py8
-rw-r--r--pw_build/py/BUILD.gn22
-rwxr-xr-xpw_build/py/python_runner_test.py47
-rw-r--r--pw_cli/py/BUILD.gn34
-rw-r--r--pw_doctor/py/BUILD.gn25
-rw-r--r--pw_env_setup/py/BUILD.gn37
-rw-r--r--pw_hdlc_lite/py/BUILD.gn37
-rw-r--r--pw_module/py/BUILD.gn26
-rw-r--r--pw_presubmit/py/BUILD.gn39
-rw-r--r--pw_protobuf/py/BUILD.gn28
-rw-r--r--pw_protobuf_compiler/py/BUILD.gn30
-rw-r--r--pw_rpc/py/BUILD.gn43
-rw-r--r--pw_rpc/py/setup.py3
-rw-r--r--pw_status/py/BUILD.gn25
-rw-r--r--pw_tokenizer/py/BUILD.gn23
-rw-r--r--pw_trace/py/BUILD.gn26
-rw-r--r--pw_trace_tokenized/py/BUILD.gn25
-rw-r--r--pw_unit_test/py/BUILD.gn26
-rw-r--r--pw_watch/py/BUILD.gn27
22 files changed, 588 insertions, 46 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 0c0fba843..ec3d18b77 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -114,7 +114,37 @@ group("docs") {
}
pw_python_group("python") {
- python_deps = [ ":python_packages($_default_toolchain_prefix$pw_default_optimization_level)" ]
+ _python_packages = [
+ "$dir_pw_allocator/py",
+ "$dir_pw_arduino_build/py",
+ "$dir_pw_build/py",
+ "$dir_pw_cli/py",
+ "$dir_pw_doctor/py",
+ "$dir_pw_env_setup/py",
+ "$dir_pw_hdlc_lite/py",
+ "$dir_pw_module/py",
+ "$dir_pw_presubmit/py",
+ "$dir_pw_protobuf_compiler/py",
+ "$dir_pw_protobuf/py",
+ "$dir_pw_rpc/py",
+ "$dir_pw_status/py",
+ "$dir_pw_tokenizer/py",
+ "$dir_pw_trace/py",
+ "$dir_pw_trace_tokenized/py",
+ "$dir_pw_unit_test/py",
+ "$dir_pw_watch/py",
+
+ # TODO(pwbug/239): Structure pw_docgen as Python packages.
+ # "$dir_pw_bloat/py",
+ # "$dir_pw_docgen/py",
+ ]
+
+ _toolchain = "$_default_toolchain_prefix$pw_default_optimization_level"
+
+ python_deps = []
+ foreach(dep, _python_packages) {
+ python_deps += [ "$dep($_toolchain)" ]
+ }
}
# By default, Pigweed will build this target when invoking ninja.
@@ -160,13 +190,6 @@ group("pigweed_default") {
# Prevent the default toolchain from parsing any other BUILD.gn files.
if (current_toolchain != default_toolchain) {
- pw_python_group("python_packages") {
- python_deps = [
- "$dir_pw_tokenizer/py",
- # TODO(pwbug/239): Add all Pigweed Python packages
- ]
- }
-
group("apps") {
# Application images built for all targets.
deps = [ "$dir_pw_hdlc_lite/rpc_example" ]
diff --git a/pw_allocator/py/BUILD.gn b/pw_allocator/py/BUILD.gn
new file mode 100644
index 000000000..2baa9eb58
--- /dev/null
+++ b/pw_allocator/py/BUILD.gn
@@ -0,0 +1,26 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_allocator/__init__.py",
+ "pw_allocator/heap_viewer.py",
+ ]
+ python_deps = [ "$dir_pw_cli/py" ]
+}
diff --git a/pw_arduino_build/py/BUILD.gn b/pw_arduino_build/py/BUILD.gn
new file mode 100644
index 000000000..c0f2e0052
--- /dev/null
+++ b/pw_arduino_build/py/BUILD.gn
@@ -0,0 +1,38 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_arduino_build/__init__.py",
+ "pw_arduino_build/__main__.py",
+ "pw_arduino_build/builder.py",
+ "pw_arduino_build/core_installer.py",
+ "pw_arduino_build/file_operations.py",
+ "pw_arduino_build/log.py",
+ "pw_arduino_build/teensy_detector.py",
+ "pw_arduino_build/unit_test_client.py",
+ "pw_arduino_build/unit_test_runner.py",
+ "pw_arduino_build/unit_test_server.py",
+ ]
+ tests = [
+ "builder_test.py",
+ "file_operations_test.py",
+ ]
+ python_deps = [ "$dir_pw_cli/py" ]
+}
diff --git a/pw_arduino_build/py/file_operations_test.py b/pw_arduino_build/py/file_operations_test.py
index 9d1fe03cd..bd387b9f2 100644
--- a/pw_arduino_build/py/file_operations_test.py
+++ b/pw_arduino_build/py/file_operations_test.py
@@ -58,16 +58,16 @@ class TestFileOperations(unittest.TestCase):
"sources recursive", file_set(), ["**/*.ino", "**/*.h", "**/*.cpp"],
[
"app.ino",
- "core/pwm/pulse.h",
- "libraries/b.cpp",
- "libraries/c.h",
+ os.path.join("core", "pwm", "pulse.h"),
+ os.path.join("libraries", "b.cpp"),
+ os.path.join("libraries", "c.h"),
]
),
(
"directories recursive", file_set(), ["**"],
[
"core",
- "core/pwm",
+ os.path.join("core", "pwm"),
"libraries",
]
),
diff --git a/pw_build/py/BUILD.gn b/pw_build/py/BUILD.gn
index bf28ba396..475c7246c 100644
--- a/pw_build/py/BUILD.gn
+++ b/pw_build/py/BUILD.gn
@@ -12,12 +12,24 @@
# License for the specific language governing permissions and limitations under
# the License.
-# gn-format disable
import("//build_overrides/pigweed.gni")
-import("$dir_pw_build/input_group.gni")
+import("$dir_pw_build/python.gni")
-# TODO(hepler): Replace this with a pw_python_package.
-pw_input_group("py") {
- inputs = [ "pw_build/generated_tests.py" ]
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_build/__init__.py",
+ "pw_build/exec.py",
+ "pw_build/generate_python_package_gn.py",
+ "pw_build/generated_tests.py",
+ "pw_build/host_tool.py",
+ "pw_build/nop.py",
+ "pw_build/null_backend.py",
+ "pw_build/python_runner.py",
+ "pw_build/python_wheels.py",
+ "pw_build/zip.py",
+ "pw_build/zip_test.py",
+ ]
+ tests = [ "python_runner_test.py" ]
}
diff --git a/pw_build/py/python_runner_test.py b/pw_build/py/python_runner_test.py
index 8ba6edbf0..6dd3e3e32 100755
--- a/pw_build/py/python_runner_test.py
+++ b/pw_build/py/python_runner_test.py
@@ -16,14 +16,21 @@
import os
from pathlib import Path
+import platform
import tempfile
import unittest
from pw_build.python_runner import ExpressionError, GnPaths, Label, TargetInfo
from pw_build.python_runner import expand_expressions
-TEST_PATHS = GnPaths(Path('/gn_root'), Path('/gn_root/out'),
- Path('/gn_root/some/cwd'), '//toolchains/cool:ToolChain')
+ROOT = Path(r'C:\gn_root' if platform.system() == 'Windows' else '/gn_root')
+
+TEST_PATHS = GnPaths(
+ ROOT,
+ ROOT / 'out',
+ ROOT / 'some' / 'cwd',
+ '//toolchains/cool:ToolChain',
+)
class LabelTest(unittest.TestCase):
@@ -38,63 +45,63 @@ class LabelTest(unittest.TestCase):
for paths, toolchain in self._paths_and_toolchain_name:
label = Label(paths, '//')
self.assertEqual(label.name, '')
- self.assertEqual(label.dir, Path('/gn_root'))
+ self.assertEqual(label.dir, ROOT)
self.assertEqual(label.out_dir,
- Path('/gn_root/out', toolchain, 'obj'))
+ ROOT.joinpath('out', toolchain, 'obj'))
self.assertEqual(label.gen_dir,
- Path('/gn_root/out', toolchain, 'gen'))
+ ROOT.joinpath('out', toolchain, 'gen'))
def test_absolute(self):
for paths, toolchain in self._paths_and_toolchain_name:
label = Label(paths, '//foo/bar:baz')
self.assertEqual(label.name, 'baz')
- self.assertEqual(label.dir, Path('/gn_root/foo/bar'))
+ self.assertEqual(label.dir, ROOT.joinpath('foo/bar'))
self.assertEqual(label.out_dir,
- Path('/gn_root/out', toolchain, 'obj/foo/bar'))
+ ROOT.joinpath('out', toolchain, 'obj/foo/bar'))
self.assertEqual(label.gen_dir,
- Path('/gn_root/out', toolchain, 'gen/foo/bar'))
+ ROOT.joinpath('out', toolchain, 'gen/foo/bar'))
def test_absolute_implicit_target(self):
for paths, toolchain in self._paths_and_toolchain_name:
label = Label(paths, '//foo/bar')
self.assertEqual(label.name, 'bar')
- self.assertEqual(label.dir, Path('/gn_root/foo/bar'))
+ self.assertEqual(label.dir, ROOT.joinpath('foo/bar'))
self.assertEqual(label.out_dir,
- Path('/gn_root/out', toolchain, 'obj/foo/bar'))
+ ROOT.joinpath('out', toolchain, 'obj/foo/bar'))
self.assertEqual(label.gen_dir,
- Path('/gn_root/out', toolchain, 'gen/foo/bar'))
+ ROOT.joinpath('out', toolchain, 'gen/foo/bar'))
def test_relative(self):
for paths, toolchain in self._paths_and_toolchain_name:
label = Label(paths, ':tgt')
self.assertEqual(label.name, 'tgt')
- self.assertEqual(label.dir, Path('/gn_root/some/cwd'))
+ self.assertEqual(label.dir, ROOT.joinpath('some/cwd'))
self.assertEqual(label.out_dir,
- Path('/gn_root/out', toolchain, 'obj/some/cwd'))
+ ROOT.joinpath('out', toolchain, 'obj/some/cwd'))
self.assertEqual(label.gen_dir,
- Path('/gn_root/out', toolchain, 'gen/some/cwd'))
+ ROOT.joinpath('out', toolchain, 'gen/some/cwd'))
def test_relative_subdir(self):
for paths, toolchain in self._paths_and_toolchain_name:
label = Label(paths, 'tgt')
self.assertEqual(label.name, 'tgt')
- self.assertEqual(label.dir, Path('/gn_root/some/cwd/tgt'))
+ self.assertEqual(label.dir, ROOT.joinpath('some/cwd/tgt'))
self.assertEqual(
label.out_dir,
- Path('/gn_root/out', toolchain, 'obj/some/cwd/tgt'))
+ ROOT.joinpath('out', toolchain, 'obj/some/cwd/tgt'))
self.assertEqual(
label.gen_dir,
- Path('/gn_root/out', toolchain, 'gen/some/cwd/tgt'))
+ ROOT.joinpath('out', toolchain, 'gen/some/cwd/tgt'))
def test_relative_parent_dir(self):
for paths, toolchain in self._paths_and_toolchain_name:
label = Label(paths, '..:tgt')
self.assertEqual(label.name, 'tgt')
- self.assertEqual(label.dir, Path('/gn_root/some'))
+ self.assertEqual(label.dir, ROOT.joinpath('some'))
self.assertEqual(label.out_dir,
- Path('/gn_root/out', toolchain, 'obj/some'))
+ ROOT.joinpath('out', toolchain, 'obj/some'))
self.assertEqual(label.gen_dir,
- Path('/gn_root/out', toolchain, 'gen/some'))
+ ROOT.joinpath('out', toolchain, 'gen/some'))
class ResolvePathTest(unittest.TestCase):
diff --git a/pw_cli/py/BUILD.gn b/pw_cli/py/BUILD.gn
new file mode 100644
index 000000000..46e803e16
--- /dev/null
+++ b/pw_cli/py/BUILD.gn
@@ -0,0 +1,34 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_cli/__init__.py",
+ "pw_cli/__main__.py",
+ "pw_cli/arguments.py",
+ "pw_cli/branding.py",
+ "pw_cli/color.py",
+ "pw_cli/env.py",
+ "pw_cli/envparse.py",
+ "pw_cli/envparse_test.py",
+ "pw_cli/log.py",
+ "pw_cli/plugins.py",
+ "pw_cli/process.py",
+ ]
+}
diff --git a/pw_doctor/py/BUILD.gn b/pw_doctor/py/BUILD.gn
new file mode 100644
index 000000000..0408128ee
--- /dev/null
+++ b/pw_doctor/py/BUILD.gn
@@ -0,0 +1,25 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_doctor/__init__.py",
+ "pw_doctor/doctor.py",
+ ]
+}
diff --git a/pw_env_setup/py/BUILD.gn b/pw_env_setup/py/BUILD.gn
new file mode 100644
index 000000000..2ad8b671b
--- /dev/null
+++ b/pw_env_setup/py/BUILD.gn
@@ -0,0 +1,37 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_env_setup/__init__.py",
+ "pw_env_setup/cargo_setup/__init__.py",
+ "pw_env_setup/cipd_setup/__init__.py",
+ "pw_env_setup/cipd_setup/update.py",
+ "pw_env_setup/cipd_setup/wrapper.py",
+ "pw_env_setup/colors.py",
+ "pw_env_setup/env_setup.py",
+ "pw_env_setup/environment.py",
+ "pw_env_setup/environment_test.py",
+ "pw_env_setup/spinner.py",
+ "pw_env_setup/virtualenv_setup/__init__.py",
+ "pw_env_setup/virtualenv_setup/__main__.py",
+ "pw_env_setup/virtualenv_setup/install.py",
+ "pw_env_setup/windows_env_start.py",
+ ]
+}
diff --git a/pw_hdlc_lite/py/BUILD.gn b/pw_hdlc_lite/py/BUILD.gn
new file mode 100644
index 000000000..1b18011c6
--- /dev/null
+++ b/pw_hdlc_lite/py/BUILD.gn
@@ -0,0 +1,37 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_hdlc_lite/__init__.py",
+ "pw_hdlc_lite/decode.py",
+ "pw_hdlc_lite/encode.py",
+ "pw_hdlc_lite/protocol.py",
+ "pw_hdlc_lite/rpc.py",
+ "pw_hdlc_lite/rpc_console.py",
+ ]
+ tests = [
+ "decode_test.py",
+ "encode_test.py",
+ ]
+ python_deps = [
+ "$dir_pw_protobuf_compiler/py",
+ "$dir_pw_rpc/py",
+ ]
+}
diff --git a/pw_module/py/BUILD.gn b/pw_module/py/BUILD.gn
new file mode 100644
index 000000000..09f7896c2
--- /dev/null
+++ b/pw_module/py/BUILD.gn
@@ -0,0 +1,26 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_module/__init__.py",
+ "pw_module/check.py",
+ ]
+ tests = [ "check_test.py" ]
+}
diff --git a/pw_presubmit/py/BUILD.gn b/pw_presubmit/py/BUILD.gn
new file mode 100644
index 000000000..410925674
--- /dev/null
+++ b/pw_presubmit/py/BUILD.gn
@@ -0,0 +1,39 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_presubmit/__init__.py",
+ "pw_presubmit/build.py",
+ "pw_presubmit/cli.py",
+ "pw_presubmit/environment.py",
+ "pw_presubmit/format_code.py",
+ "pw_presubmit/git_repo.py",
+ "pw_presubmit/install_hook.py",
+ "pw_presubmit/pigweed_presubmit.py",
+ "pw_presubmit/presubmit.py",
+ "pw_presubmit/python_checks.py",
+ "pw_presubmit/tools.py",
+ ]
+ tests = [
+ "presubmit_test.py",
+ "tools_test.py",
+ ]
+ python_deps = [ "$dir_pw_cli/py" ]
+}
diff --git a/pw_protobuf/py/BUILD.gn b/pw_protobuf/py/BUILD.gn
new file mode 100644
index 000000000..edee3aa84
--- /dev/null
+++ b/pw_protobuf/py/BUILD.gn
@@ -0,0 +1,28 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_protobuf/__init__.py",
+ "pw_protobuf/codegen_pwpb.py",
+ "pw_protobuf/output_file.py",
+ "pw_protobuf/plugin.py",
+ "pw_protobuf/proto_tree.py",
+ ]
+}
diff --git a/pw_protobuf_compiler/py/BUILD.gn b/pw_protobuf_compiler/py/BUILD.gn
new file mode 100644
index 000000000..6927bb118
--- /dev/null
+++ b/pw_protobuf_compiler/py/BUILD.gn
@@ -0,0 +1,30 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_protobuf_compiler/__init__.py",
+ "pw_protobuf_compiler/generate_protos.py",
+ "pw_protobuf_compiler/generator_not_selected.py",
+ "pw_protobuf_compiler/proto_target_invalid.py",
+ "pw_protobuf_compiler/python_protos.py",
+ ]
+ tests = [ "python_protos_test.py" ]
+ python_deps = [ "$dir_pw_cli/py" ]
+}
diff --git a/pw_rpc/py/BUILD.gn b/pw_rpc/py/BUILD.gn
new file mode 100644
index 000000000..9e6279360
--- /dev/null
+++ b/pw_rpc/py/BUILD.gn
@@ -0,0 +1,43 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_rpc/__init__.py",
+ "pw_rpc/callback_client.py",
+ "pw_rpc/client.py",
+ "pw_rpc/codegen_nanopb.py",
+ "pw_rpc/descriptors.py",
+ "pw_rpc/ids.py",
+ "pw_rpc/packet_pb2.py",
+ "pw_rpc/packets.py",
+ "pw_rpc/plugin.py",
+ ]
+ tests = [
+ "callback_client_test.py",
+ "client_test.py",
+ "codegen_test.py",
+ "ids_test.py",
+ "packets_test.py",
+ ]
+ python_deps = [
+ "$dir_pw_protobuf_compiler/py",
+ "$dir_pw_status/py",
+ ]
+}
diff --git a/pw_rpc/py/setup.py b/pw_rpc/py/setup.py
index 708371b74..3324949c6 100644
--- a/pw_rpc/py/setup.py
+++ b/pw_rpc/py/setup.py
@@ -27,7 +27,8 @@ setuptools.setup(
entry_points={'console_scripts': ['pw_rpc_codegen = pw_rpc.plugin:main']},
install_requires=[
'protobuf',
- 'pw_protobuf',
+ # 'pw_protobuf_compiler',
+ # 'pw_status',
],
tests_require=['pw_build'],
)
diff --git a/pw_status/py/BUILD.gn b/pw_status/py/BUILD.gn
new file mode 100644
index 000000000..d6d12c91f
--- /dev/null
+++ b/pw_status/py/BUILD.gn
@@ -0,0 +1,25 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_status/__init__.py",
+ "pw_status/update_style.py",
+ ]
+}
diff --git a/pw_tokenizer/py/BUILD.gn b/pw_tokenizer/py/BUILD.gn
index 7335afe6d..1c568fd13 100644
--- a/pw_tokenizer/py/BUILD.gn
+++ b/pw_tokenizer/py/BUILD.gn
@@ -18,14 +18,6 @@ import("$dir_pw_build/python.gni")
pw_python_package("py") {
setup = [ "setup.py" ]
- tests = [
- "database_test.py",
- "detokenize_test.py",
- "encode_test.py",
- "tokens_test.py",
- "decode_test.py",
- "elf_reader_test.py",
- ]
sources = [
"pw_tokenizer/__init__.py",
"pw_tokenizer/__main__.py",
@@ -37,4 +29,19 @@ pw_python_package("py") {
"pw_tokenizer/serial_detokenizer.py",
"pw_tokenizer/tokens.py",
]
+ tests = [
+ "database_test.py",
+ "decode_test.py",
+ "detokenize_test.py",
+ "elf_reader_test.py",
+ "encode_test.py",
+ "tokens_test.py",
+ ]
+ inputs = [
+ "generate_argument_types_macro.py",
+ "generate_hash_macro.py",
+ "generate_hash_test_data.py",
+ "tokenized_string_decoding_test_data.py",
+ "varint_test_data.py",
+ ]
}
diff --git a/pw_trace/py/BUILD.gn b/pw_trace/py/BUILD.gn
new file mode 100644
index 000000000..caf8bc503
--- /dev/null
+++ b/pw_trace/py/BUILD.gn
@@ -0,0 +1,26 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_trace/__init__.py",
+ "pw_trace/trace.py",
+ ]
+ tests = [ "trace_test.py" ]
+}
diff --git a/pw_trace_tokenized/py/BUILD.gn b/pw_trace_tokenized/py/BUILD.gn
new file mode 100644
index 000000000..bae2cde7d
--- /dev/null
+++ b/pw_trace_tokenized/py/BUILD.gn
@@ -0,0 +1,25 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_trace_tokenized/__init__.py",
+ "pw_trace_tokenized/trace_tokenized.py",
+ ]
+}
diff --git a/pw_unit_test/py/BUILD.gn b/pw_unit_test/py/BUILD.gn
new file mode 100644
index 000000000..8f37417fb
--- /dev/null
+++ b/pw_unit_test/py/BUILD.gn
@@ -0,0 +1,26 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_unit_test/__init__.py",
+ "pw_unit_test/test_runner.py",
+ ]
+ python_deps = [ "$dir_pw_cli/py" ]
+}
diff --git a/pw_watch/py/BUILD.gn b/pw_watch/py/BUILD.gn
new file mode 100644
index 000000000..a8fe59d4c
--- /dev/null
+++ b/pw_watch/py/BUILD.gn
@@ -0,0 +1,27 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pw_watch/__init__.py",
+ "pw_watch/debounce.py",
+ "pw_watch/watch.py",
+ "pw_watch/watch_test.py",
+ ]
+}