pw_presubmit: environment fixes

Need to be able to pass in a requirements file, and fix what appears to
be a copy/paste error.

Change-Id: If6f0b78db68a098ba962fce9ce03cb425a188842
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/15561
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Rob Mohr <mohrr@google.com>
diff --git a/pw_presubmit/py/pw_presubmit/environment.py b/pw_presubmit/py/pw_presubmit/environment.py
index 372b299..1b54a7a 100644
--- a/pw_presubmit/py/pw_presubmit/environment.py
+++ b/pw_presubmit/py/pw_presubmit/environment.py
@@ -64,14 +64,13 @@
         pigweed_root: Path,
         output_directory: Path,
         setup_py_roots: Iterable[Union[Path, str]] = (),
+        requirements: Iterable[Union[Path, str]] = (),
 ) -> None:
     """Sets up a virtualenv, assumes recent Python 3 is already installed."""
     virtualenv_source = pigweed_root.joinpath('pw_env_setup', 'py',
                                               'pw_env_setup',
                                               'virtualenv_setup')
 
-    # TODO(pwbug/138): find way to support dependent project requirements.
-
     # For speed, don't build the venv if it exists. Use --clean to rebuild.
     if not output_directory.joinpath('pyvenv.cfg').is_file():
         call(
@@ -79,6 +78,7 @@
             virtualenv_source,
             f'--venv_path={output_directory}',
             f'--requirements={virtualenv_source / "requirements.txt"}',
+            *(f'--requirements={x}' for x in requirements),
             *(f'--setup-py-root={p}' for p in [pigweed_root, *setup_py_roots]),
         )
 
diff --git a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
index 6f604fe..3753fa9 100755
--- a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
+++ b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
@@ -49,7 +49,7 @@
 
 
 def init_virtualenv(ctx: PresubmitContext):
-    environment.init_cipd(ctx.root, ctx.output_dir)
+    environment.init_virtualenv(ctx.root, ctx.output_dir)
 
 
 #