Commit Graph

15 Commits

Author SHA1 Message Date
Wyatt Hepler
1ccce6b953 pw_cli: Disable colors if the output is not a tty
Bug: 19

Change-Id: Ibdc1f72643415acb12dbf731cd45a9cb786a9fd2
2019-12-17 18:40:46 +00:00
Keir Mierle
028ee9feb3 Lint fixes
Change-Id: I00b93c8e951d28deb2212bbba660dd6528433502
2019-12-16 10:08:55 -08:00
Keir Mierle
7178877ec2 pw watch: Minor UI/logging tweaks
Change-Id: I85da72f666ee111b7fe03f2f3d209167449286d7
2019-12-13 20:49:23 +00:00
Alexei Frolov
942adf02d6 Add pw_protobuf_compiler module
This change adds a module responsible for invoking the protobuf compiler
to generate code from .proto definition files. It provides a GN template
which performs the codegen operation on a list of input .proto files.
The template currently only supports C++.

Change-Id: I5558fd5b4282e0d6f09f8fafebda972738dc1e83
2019-12-13 19:38:27 +00:00
Rob Mohr
8edfeaeec0 Rename help to short_help.
Change-Id: Ibd41f06c2701b6c68a4a45c08a07c335679b976c
2019-12-09 13:45:01 -08:00
Rob Mohr
e023ba9577 Fix pylint warnings.
Change-Id: I8ef482776bcb5ec89afde39f215bd52c950a4b1b
2019-12-09 09:59:51 -08:00
Wyatt Hepler
becb431e5f Apply pw format to the repository
Change-Id: I3c8e4f956dfe6c9e81d3069f72c30c5950852074
2019-12-05 09:31:11 -08:00
Armando Montanez
93e445e84b pw_cli: Remove date/time from subprocess logs
When python scripts are run using pw_cli.subprocess, the output of their
lgos will be prefixed with a date/time stamp. This change prevents
subprocesses from adding a second timestamp.

Example:
~/pigweed/pigweed$ pw test --root out/stm32f429i-disc1/ --runner stm32f429i_disc1_unit_test_runner -- --port /dev/ttyACM0

 ▒█████▄   █▓  ▄███▒  ▒█    ▒█ ░▓████▒ ░▓████▒ ▒▓████▄
  ▒█░  █░ ░█▒ ██▒ ▀█▒ ▒█░ █ ▒█  ▒█   ▀  ▒█   ▀  ▒█  ▀█▌
  ▒█▄▄▄█░ ░█▒ █▓░ ▄▄░ ▒█░ █ ▒█  ▒███    ▒███    ░█   █▌
  ▒█▀     ░█░ ▓█   █▓ ░█░ █ ▒█  ▒█   ▄  ▒█   ▄  ░█  ▄█▌
  ▒█      ░█░ ░▓███▀   ▒█▓▀▓█░ ░▓████▒ ░▓████▒ ▒▓████▀

20191202 14:30:07 INF Scanning for tests...
20191202 14:30:07 INF Found 4 test groups (10 tests).
20191202 14:30:07 INF Running test groups //pw_status:tests, //pw_preprocessor:tests, //pw_string:tests, //pw_span:tests
20191202 14:30:07 INF Test  1/10: [RUN] concat_test
20191202 14:30:07 OUT [24930] INF Flashing firmware to device...
20191202 14:30:07 OUT [24930] INF Successfully flashed firmware to device!
20191202 14:30:07 OUT [24930] INF Test passed!
20191202 14:30:08 INF stm32f429i_disc1_unit_test_runner exited successfully
20191202 14:30:08 INF Test  1/10: [PASS] concat_test
20191202 14:30:08 INF Test  2/10: [RUN] type_to_string_test
20191202 14:30:08 OUT [24947] INF Flashing firmware to device...
20191202 14:30:09 OUT [24947] INF Successfully flashed firmware to device!
20191202 14:30:11 OUT [24947] INF Test passed!
20191202 14:30:11 INF stm32f429i_disc1_unit_test_runner exited successfully

Change-Id: I9ea7cafcde2183132f54e135ecadd7b2878f71f0
2019-12-03 18:32:43 +00:00
Alexei Frolov
572ca89be2 Add environment variable to pw_cli.process module
This change sets an environment variable in the subprocess run by
pw_cli.process.run() to indicate that it is running as a subprocess.

Change-Id: I1def3259b62578a156a4b374d41af99692147699
2019-12-02 21:48:12 +00:00
Wyatt Hepler
dac350b8e1 presubmit: Improve venv setup; expand checks
- Use env_setup/virtualenv/init.py to setup the Python venv.
- Improve diff colorization.
- Add function for finding Python packages from .py file changes.
- Add check that runs Python tests.
- Enable full pylint and yapf as warnings.
- Delete unused code in watch.py that used an undefined variable.
- Enable required python -E check.

Change-Id: I5ba9882ea9ec93f006260d5636031dd0b5005a85
2019-12-02 21:37:19 +00:00
Wyatt Hepler
c3844d9c3e Clean up requirements.txt
- Have requirements.in only include what is necessary for the build.
- Update requirements.txt.
- Remove pw_cli/requirements.txt since the dependencies are noted in the
  setup.py.

Change-Id: I622d066312c0436074d10fe6e8345feed1c31d06
2019-11-27 22:34:02 +00:00
Wyatt Hepler
1a96094ce6 Fix copyright notices
- Add missing copright header in conf.py.
- Fix inconsistent copyright notice line breaking.

Change-Id: Ib78f7768643069c49ff986a48a176df9fd06e891
2019-11-27 22:34:02 +00:00
Keir Mierle
ab847d9479 pw_module: Start the Pigweed meta-module
This starts a basic Pigweed meta-module tool. The first tool is a simple
checker invoked with

  pw module-check

which for now does two super-simple checks. Example output:

$ pw module-check pw_module
20191125 07:53:57 PM INF Checking module: pw_module
20191125 07:53:57 PM INF OK: Module pw_module looks good; no errors or warnings found

$ pw module-check pw_foo
20191125 07:54:00 PM INF Checking module: pw_foo
20191125 07:54:00 PM ERR PWCK001: Python code present but no setup.py.
20191125 07:54:00 PM ERR PWCK002: C++ code present but no tests at all (you monster).
20191125 07:54:00 PM ERR FAIL: Found errors when checking module pw_foo

Change-Id: I6eb3bfa941abc450a33affbec3e005477b9b2dc4
2019-11-27 21:33:13 +00:00
Alexei Frolov
8253ad8d66 Module to run subprocesses with captured output
This change adds a module within pw_cli that provides a function for
running a subprocess and capturing its stdout and stderr to the main
pw log. A new log level is defined for the captured output.

The pw_unit_test runner script is updated to use this function instead
of running its subprocess directly.

The pw command is updated to run its subcommand in an async context,
preventing subcommands from needing to create their own. Fully
synchronous subcommands continue to function transparently to this.

Change-Id: Ia9efb1fbda8a38ef91a0e14113929711038710a8
2019-11-27 20:34:16 +00:00
Keir Mierle
54f457f205 Rename pw_cmd to pw_cli
This renames pw_cmd to pw_cli, since our plan is for the cli module to
contain general command line interface related tooling, rather than just
the pw_cmd itself.

Change-Id: I1dc7185db25b89d725601ac5d47e0793ea907bf1
2019-11-25 22:16:02 +00:00