- add sources.
[platform/framework/web/crosswalk.git] / src / native_client_sdk / src / build_tools / sdk_tools / command / uninstall.py
1 # Copyright (c) 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 import os
6 import logging
7
8 import command_common
9 import sdk_update_common
10
11 def Uninstall(install_dir, local_manifest, bundle_names):
12   valid_bundles, invalid_bundles = \
13       command_common.GetValidBundles(local_manifest, bundle_names)
14   if invalid_bundles:
15     logging.warn('Unknown bundle(s): %s\n' % (', '.join(invalid_bundles)))
16
17   if not valid_bundles:
18     logging.warn('No bundles to uninstall.')
19     return
20
21   for bundle_name in valid_bundles:
22     logging.info('Removing %s' % (bundle_name,))
23     bundle_dir = os.path.join(install_dir, bundle_name)
24     try:
25       sdk_update_common.RemoveDir(bundle_dir)
26     except Exception as e:
27       logging.error('Failed to remove directory \"%s\".  %s' % (bundle_dir, e))
28       continue
29     local_manifest.RemoveBundle(bundle_name)