cros_choose_profile: add Path support
Tweak the PathPrefixDecorator API enough to pass tests.
BUG=None
TEST=CQ passes
Change-Id: I690507a50bcf105b7efc7c729f28c7330c564722
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3600074
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Sergey Frolov <sfrolov@google.com>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/cros_choose_profile.py b/scripts/cros_choose_profile.py
index 25cf70b..8b065fe 100644
--- a/scripts/cros_choose_profile.py
+++ b/scripts/cros_choose_profile.py
@@ -35,7 +35,12 @@
if not prefix or not result:
# Nothing to do.
return result
- elif not isinstance(result, str):
+
+ # Convert Path objects to str.
+ if isinstance(prefix, os.PathLike):
+ prefix = str(prefix)
+
+ if not isinstance(result, str):
# Transform each path in the collection.
new_result = []
for path in result: