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

Unified Diff: tools/cr/cr/commands/init.py

Issue 1562083002: Fix recognition of "linuxchromeos" directory in cr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sandbox
Patch Set: Fix rebase. Created 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cr/cr/commands/init.py
diff --git a/tools/cr/cr/commands/init.py b/tools/cr/cr/commands/init.py
index 647176a7c4f99997954501d955fefd2084a5f6e3..7b09330cbf8c81c91c59d52cfe4340a33705de81 100644
--- a/tools/cr/cr/commands/init.py
+++ b/tools/cr/cr/commands/init.py
@@ -83,13 +83,16 @@ class InitCommand(cr.Command):
# Try to guess platform based on output name
platforms = [p.name for p in cr.Platform.AllPlugins()]
matches = [p for p in platforms if p in base]
- if len(matches) != 1:
+ # Get the longest matching string and check if the others are
+ # substrings. This is done to support "linuxchromeos" and "linux".
+ platform = max(matches, key=len)
+ all_matches_are_substrings = all(p in platform for p in matches)
+ if all_matches_are_substrings or not matches:
print 'Platform is not set, and could not be guessed from', base
print 'Should be one of', ','.join(platforms)
if len(matches) > 1:
print 'Matched all of', ','.join(matches)
exit(1)
- platform = matches[0]
generator = cr.context.args.CR_GENERATOR
if not generator:
generator = 'gyp'
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698