OLD | NEW |
(Empty) | |
| 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 __all__ = ['AddSource', 'RemoveSource', 'ListSources'] |
| 9 |
| 10 def AddSource(config, url): |
| 11 try: |
| 12 download.UrlOpen(url) |
| 13 except Exception as e: |
| 14 raise Error('Not adding %s, unable to load URL.\n %s' % (url, e)) |
| 15 config.AddSource(url) |
| 16 |
| 17 |
| 18 def RemoveSource(config, url): |
| 19 if url == 'all': |
| 20 config.RemoveAllSources() |
| 21 else: |
| 22 config.RemoveSource(url) |
| 23 |
| 24 |
| 25 def ListSources(config): |
| 26 if config.sources: |
| 27 print 'Installed sources:' |
| 28 for s in config.sources: |
| 29 print ' ' + s |
| 30 else: |
| 31 print 'No external sources installed.' |
OLD | NEW |