Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: tools/cr/cr/actions/builder.py

Issue 136553002: cr: Print a list of closest matching targets when no match is found (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/cr/cr/targets/target.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cr/cr/actions/builder.py
diff --git a/tools/cr/cr/actions/builder.py b/tools/cr/cr/actions/builder.py
index 74959afe627e5acf06f07b3e95f0979dc540e02f..286d2ec92e492ae538f9ba57e260a0d63dc8c9c2 100644
--- a/tools/cr/cr/actions/builder.py
+++ b/tools/cr/cr/actions/builder.py
@@ -4,6 +4,8 @@
"""A module for the Builder base class."""
+import difflib
+
import cr
@@ -56,6 +58,11 @@ class Builder(cr.Action, cr.Plugin.Type):
"""Check if a target name is on the builder knows about."""
return target_name in self.GetTargets(context)
+ @cr.Plugin.activemethod
+ def GuessTargets(self, context, target_name):
+ """Returns a list of closest matching targets for a named target."""
+ return difflib.get_close_matches(target_name, self.GetTargets(context))
+
class SkipBuilder(Builder):
"""The "skip" version of a Builder, causes the build step to be skipped."""
« no previous file with comments | « no previous file | tools/cr/cr/targets/target.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698