Move common_pb2.Path->pathlib.Path converter
Previously I had implemented a helper function that converts
common_pb2.Path objects into pathlib.Path objects. I put that function
in lib/path_util.py, since it is a little utility relating to paths.
However, based on feedback in the attached bug, it seems that lib/
should not rely on protobufs. Thus, this CL moves the function into
api/.
I've also renamed the function to be consistent with Chromite's newer
snake_case guidance, and I've renamed some internal variable names for
the sake of clarity.
BUG=b:268732304
TEST=./run_tests
Change-Id: I203ba6c278cd043b2732a132ee19befa451e08ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4389805
Commit-Queue: Greg Edelston <gredelston@google.com>
Tested-by: Greg Edelston <gredelston@google.com>
Auto-Submit: Greg Edelston <gredelston@google.com>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/api/controller/sdk.py b/api/controller/sdk.py
index 6f9ab40..f667d4c 100644
--- a/api/controller/sdk.py
+++ b/api/controller/sdk.py
@@ -14,7 +14,6 @@
from chromite.api.controller import controller_util
from chromite.api.gen.chromiumos import common_pb2
from chromite.lib import cros_build_lib
-from chromite.lib import path_util
from chromite.service import sdk
@@ -77,10 +76,10 @@
_assert_path_is_absolute(input_proto.sdk_path.path, "SDK path")
_assert_path_is_absolute(input_proto.dest_dir.path, "destination directory")
- sdk_path = path_util.ProtoPathToPathlibPath(
+ sdk_path = controller_util.pb2_path_to_pathlib_path(
input_proto.sdk_path, input_proto.chroot
)
- dest_dir = path_util.ProtoPathToPathlibPath(
+ dest_dir = controller_util.pb2_path_to_pathlib_path(
input_proto.dest_dir, input_proto.chroot
)