Home | History | Annotate | Download | only in command
      1 # Copyright (c) 2012 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 import download
      6 from sdk_update_common import Error
      7 
      8 def AddSource(config, url):
      9   try:
     10     download.UrlOpen(url)
     11   except Exception as e:
     12     raise Error('Not adding %s, unable to load URL.\n  %s' % (url, e))
     13   config.AddSource(url)
     14 
     15 
     16 def RemoveSource(config, url):
     17   if url == 'all':
     18     config.RemoveAllSources()
     19   else:
     20     config.RemoveSource(url)
     21 
     22 
     23 def ListSources(config):
     24   if config.sources:
     25     print 'Installed sources:'
     26     for s in config.sources:
     27       print '  ' + s
     28   else:
     29     print 'No external sources installed.'
     30