pw_build: Support building Python wheels

Implement the .wheel subtarget for pw_python_package. This builds a
wheel for that Python package. Python wheels can be collected in a
directory using pw_mirror_tree's path_data_keys option for the "wheels"
key.

Fixed: 239
Change-Id: I43d756ce9714ba834b4590de702efeafc666b9ee
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/36762
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Joe Ethier <jethier@google.com>
diff --git a/pw_build/python.rst b/pw_build/python.rst
index 7157746..520b333 100644
--- a/pw_build/python.rst
+++ b/pw_build/python.rst
@@ -75,6 +75,30 @@
     pylintrc = "$dir_pigweed/.pylintrc"
   }
 
+
+.. _module-pw_build-python-wheels:
+
+Collecting Python wheels for distribution
+-----------------------------------------
+The ``.wheel`` subtarget generates a wheel (``.whl``) for the Python package.
+Wheels for a package and its transitive dependencies can be collected by
+traversing the ``pw_python_package_wheels`` `GN metadata
+<https://gn.googlesource.com/gn/+/master/docs/reference.md#var_metadata>`_ key,
+which lists the output directory for each wheel.
+
+The ``pw_mirror_tree`` template can be used to collect wheels in an output
+directory:
+
+.. code-block::
+
+  import("$dir_pw_build/mirror_tree.gni")
+
+  pw_mirror_tree("my_wheels") {
+    path_data_keys = [ "pw_python_package_wheels" ]
+    deps = [ ":python_packages" ]
+    directory = "$root_out_dir/the_wheels"
+  }
+
 pw_python_script
 ================
 A ``pw_python_script`` represents a set of standalone Python scripts and/or
@@ -88,13 +112,6 @@
 These targets do not add any files. Their subtargets simply forward to those of
 their dependencies.
 
-pw_python_wheels
-================
-Builds and collects Python wheels for one or more ``pw_python_package`` targets.
-A package's ``.wheel`` subtarget builds the wheel for just that package.
-``pw_python_package`` collects wheels from all of its transitive dependencies
-and collects them in a specified directory.
-
 pw_python_requirements
 ======================
 Represents a set of local and PyPI requirements, with no associated source