Status Update
Comments
bl...@google.com <bl...@google.com> #2
ca...@google.com <ca...@google.com> #3
Since this is likely a build system change, Ted, I think you are best fit for this.
ap...@google.com <ap...@google.com> #4
Branch: main
commit ab02795c6850a9a69dcb2f447874802f1f0ec413
Author: Ted Pudlik <tpudlik@google.com>
Date: Fri Nov 17 20:02:41 2023
bazel: Partial pw_system_console fix
This is not sufficient to get pw_system_console working in upstream
(we're still blocked on upgrading the py_proto_library implementation),
but will fix the console in google3.
Bug:
Bug:
Change-Id: I0baab02bbb46b93acaf5eafb326ad7585308d69a
Reviewed-on:
Pigweed-Auto-Submit: Ted Pudlik <tpudlik@google.com>
Reviewed-by: Carlos Chinchilla <cachinchilla@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
M pw_system/py/BUILD.bazel
A pw_trace/py/BUILD.bazel
A pw_trace_tokenized/py/BUILD.bazel
tp...@google.com <tp...@google.com> #5
I gave this a try, now that we can generate all the proto libraries. Unfortunately, I run into problems importing the pw_log
modules.
pw_system_console
support in the examples repo. I run,
$ bazel run //examples/01-blinky:console
INFO: Running command line: bazel-bin/examples/01-blinky/console.exe -d /dev/ttyACM0 -b 115200 examples/01-blinky/blinky.elf
Traceback (most recent call last):
File "/home/tpudlik/.cache/bazel/_bazel_tpudlik/3203ecbef1955d44b68a3ed425cfe6cb/execroot/__main__/bazel-out/k8-fastbuild/bin/examples/01-blinky/console.exe.runfiles/__main__/tools/sample_project_tools/console.py", line 21, in <module>
import pw_system.console
File "/home/tpudlik/.cache/bazel/_bazel_tpudlik/3203ecbef1955d44b68a3ed425cfe6cb/execroot/__main__/bazel-out/k8-fastbuild/bin/examples/01-blinky/console.exe.runfiles/pigweed/pw_system/py/pw_system/console.py", line 66, in <module>
from pw_system import device as pw_device
File "/home/tpudlik/.cache/bazel/_bazel_tpudlik/3203ecbef1955d44b68a3ed425cfe6cb/execroot/__main__/bazel-out/k8-fastbuild/bin/examples/01-blinky/console.exe.runfiles/pigweed/pw_system/py/pw_system/device.py", line 23, in <module>
from pw_log import log_decoder
ImportError: cannot import name 'log_decoder' from 'pw_log' (/home/tpudlik/.cache/bazel/_bazel_tpudlik/3203ecbef1955d44b68a3ed425cfe6cb/execroot/__main__/bazel-out/k8-fastbuild/bin/examples/01-blinky/console.exe.runfiles/__main__/external/pigweed/pw_log/_virtual_imports/log_proto/pw_log/__init__.py)
The relevant py_library
is in the deps. The problem is that Python gets stuck looking for the pure Python code in the generated-code directory of the pw_log
protos. I had hoped
am...@google.com <am...@google.com> #6
bazel test //pw_log/py:log_decoder_test
passes, so this should theoretically work. Also, --incompatible_default_to_explicit_init_py
should be disabling the generation of these __init__.py
files. Perhaps we need to update rules_python
?
am...@google.com <am...@google.com> #7
Also, amusingly, "it works for me" on macOS. 🤔
am...@google.com <am...@google.com> #8
Ah, that is indeed the issue; the sample project doesn't yet have --incompatible_default_to_explicit_init_py
enabled.
tp...@google.com <tp...@google.com> #9
Thanks Armando,
I verified that the Bazel-built console works with the example 01 project (
Description
This is blocked on getting some `py_proto_library` targets to build. We'll need to use the more full-featured implementation from `rules_python` for this to work (see blocking bug).