Index: native_client_sdk/src/build_tools/sdk_tools/command/sources.py |
diff --git a/native_client_sdk/src/build_tools/sdk_tools/command/sources.py b/native_client_sdk/src/build_tools/sdk_tools/command/sources.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3a7c975dcaa1c33297d57c7a090d81c1fb13f159 |
--- /dev/null |
+++ b/native_client_sdk/src/build_tools/sdk_tools/command/sources.py |
@@ -0,0 +1,29 @@ |
+# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import download |
+from sdk_update_common import Error |
+ |
+def AddSource(config, url): |
+ try: |
+ download.UrlOpen(url) |
+ except Exception as e: |
+ raise Error('Not adding %s, unable to load URL.\n %s' % (url, e)) |
+ config.AddSource(url) |
+ |
+ |
+def RemoveSource(config, url): |
+ if url == 'all': |
+ config.RemoveAllSources() |
+ else: |
+ config.RemoveSource(url) |
+ |
+ |
+def ListSources(config): |
+ if config.sources: |
+ print 'Installed sources:' |
+ for s in config.sources: |
+ print ' ' + s |
+ else: |
+ print 'No external sources installed.' |