- add sources.
[platform/framework/web/crosswalk.git] / src / tools / clang / scripts / update.py
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Windows can't run .sh files, so this is a small python wrapper around
7 update.sh.
8 """
9
10 import os
11 import subprocess
12 import sys
13
14
15 def main():
16   if sys.platform in ['win32', 'cygwin']:
17     return 0
18
19   # This script is called by gclient. gclient opens its hooks subprocesses with
20   # (stdout=subprocess.PIPE, stderr=subprocess.STDOUT) and then does custom
21   # output processing that breaks printing '\r' characters for single-line
22   # updating status messages as printed by curl and wget.
23   # Work around this by setting stderr of the update.sh process to stdin (!):
24   # gclient doesn't redirect stdin, and while stdin itself is read-only, a
25   # dup()ed sys.stdin is writable, try
26   #   fd2 = os.dup(sys.stdin.fileno()); os.write(fd2, 'hi')
27   # TODO: Fix gclient instead, http://crbug.com/95350
28   return subprocess.call(
29       [os.path.join(os.path.dirname(__file__), 'update.sh')] +  sys.argv[1:],
30       stderr=os.fdopen(os.dup(sys.stdin.fileno())))
31
32
33 if __name__ == '__main__':
34   sys.exit(main())