pw_build: pw_python_script enhancements

- Add --module option, which allows running a Python module instead of a
  script.
- Add --directory option that changes the output directory before
  running the command.
- Add pw_python_script_foreach, which is action_foreach with
  pw_python_script's features.

Change-Id: Idaa208cf9032467a7e3206043935b223cbbff559
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/20640
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
diff --git a/pw_build/docs.rst b/pw_build/docs.rst
index b27ac03..c1fc9ee 100644
--- a/pw_build/docs.rst
+++ b/pw_build/docs.rst
@@ -95,6 +95,8 @@
 ``pw_python_script`` accepts all of the arguments of a regular ``action``
 target. Additionally, it has some of its own arguments:
 
+* ``module``: Run the specified Python module instead of a script. Either
+  ``script`` or ``module`` must be specified, but not both.
 * ``capture_output``: Optional boolean. If true, script output is hidden unless
   the script fails with an error. Defaults to true.
 * ``stamp``: Optional variable indicating whether to automatically create a
@@ -102,6 +104,10 @@
   specifying ``outputs``. If ``stamp`` is true, a generic output file is
   used. If ``stamp`` is a file path, that file is used as a stamp file. Like any
   output file, ``stamp`` must be in the build directory. Defaults to false.
+* ``directory``: Optional path. Change to this directory before executing the
+  command. Paths in arguments may need to be adjusted.
+* ``environment``: Optional list of strings. Environment variables to set,
+  passed as NAME=VALUE strings.
 
 **Expressions**