1# Copyright 2013 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5"""A module for the install command.""" 6 7import cr 8 9 10class InstallCommand(cr.Command): 11 """The implementation of the install command. 12 13 This first uses Builder.Build to bring the target up to date, and then 14 installs it using Installer.Reinstall. 15 The builder installs its command line arguments, and you can use those to 16 select which builder is used. Selecting the skip builder 17 (using --builder=skip) bypasses the build stage. 18 """ 19 20 def __init__(self): 21 super(InstallCommand, self).__init__() 22 self.help = 'Install a binary' 23 24 def AddArguments(self, subparsers): 25 parser = super(InstallCommand, self).AddArguments(subparsers) 26 cr.Builder.AddArguments(self, parser) 27 cr.Installer.AddArguments(self, parser) 28 cr.Target.AddArguments(self, parser, allow_multiple=True) 29 self.ConsumeArgs(parser, 'the installer') 30 return parser 31 32 def Run(self): 33 targets = cr.Target.GetTargets() 34 if not cr.Installer.Skipping(): 35 cr.Builder.Build(targets, []) 36 cr.Installer.Reinstall(targets, cr.context.remains) 37