Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / xwalk / tools / fix-speex-checkout.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 2014 Intel Corporation. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """
8 This script is used to remove src/third_party/speex if it is checked out from
9 its own repository.
10
11 Starting with Chromium M39, it has become part of the Chromium source tree
12 itself, but the change causes "gclient sync" to consider src/third_party/speex
13 a directory that can be removed and as we pass --delete_unversioned_trees and
14 --reset to "gclient sync" in fetch_deps.py, we have to do this kind of analysis
15 before running gclient:
16
17 * If src/third_party/speex has its own .git/, it means it is checked out from
18   its own git repository and we have to remove it before syncing so that the
19   directory is created as part of chromium-crosswalk.
20 * Otherwise, we just do not do anything and assume this has already been done.
21 """
22
23 import os
24 import shutil
25
26
27 SRC_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(
28     __file__))))
29
30
31 if __name__ == '__main__':
32   speex_root = os.path.join(SRC_PATH, 'third_party', 'speex')
33
34   if os.path.isdir(os.path.join(speex_root, '.git')):
35     print 'Removing separate "%s" git checkout.' % speex_root
36     shutil.rmtree(speex_root)