LAKITU: make repohooks compatible with older COS branches BUG=b/277779682 TEST=Upload change on M93 RELEASE_NOTE=None Change-Id: I96c921e471e6d196548e3059e10f4d59e45d6798 Reviewed-on: https://cos-review.googlesource.com/c/cos/repohooks/+/50870 Reviewed-by: He Gao <hegao@google.com> Tested-by: Robert Kolchmeyer <rkolchmeyer@google.com>
diff --git a/pre-upload.py b/pre-upload.py index 3eae70d..ab069e6 100755 --- a/pre-upload.py +++ b/pre-upload.py
@@ -54,7 +54,13 @@ # The sys.path monkey patching confuses the linter. # pylint: disable=wrong-import-position -from chromite.format import formatters + +# lakitu: older branches do not have this dependency. The things that depend on +# it don't exist either, so we can ignore this import failure. +try: + from chromite.format import formatters +except ImportError: + pass from chromite.lib import commandline from chromite.lib import constants from chromite.lib import cros_build_lib