media/webrtc/trunk/tools/clang/scripts/update.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/trunk/tools/clang/scripts/update.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +#!/usr/bin/env python
     1.5 +# Copyright (c) 2012 The Chromium Authors. All rights reserved.
     1.6 +# Use of this source code is governed by a BSD-style license that can be
     1.7 +# found in the LICENSE file.
     1.8 +
     1.9 +"""Windows can't run .sh files, so this is a small python wrapper around
    1.10 +update.sh.
    1.11 +"""
    1.12 +
    1.13 +import os
    1.14 +import subprocess
    1.15 +import sys
    1.16 +
    1.17 +
    1.18 +def main():
    1.19 +  if sys.platform in ['win32', 'cygwin']:
    1.20 +    return 0
    1.21 +
    1.22 +  # This script is called by gclient. gclient opens its hooks subprocesses with
    1.23 +  # (stdout=subprocess.PIPE, stderr=subprocess.STDOUT) and then does custom
    1.24 +  # output processing that breaks printing '\r' characters for single-line
    1.25 +  # updating status messages as printed by curl and wget.
    1.26 +  # Work around this by setting stderr of the update.sh process to stdin (!):
    1.27 +  # gclient doesn't redirect stdin, and while stdin itself is read-only, a
    1.28 +  # dup()ed sys.stdin is writable, try
    1.29 +  #   fd2 = os.dup(sys.stdin.fileno()); os.write(fd2, 'hi')
    1.30 +  # TODO: Fix gclient instead, http://crbug.com/95350
    1.31 +  return subprocess.call(
    1.32 +      [os.path.join(os.path.dirname(__file__), 'update.sh')] +  sys.argv[1:],
    1.33 +      stderr=os.fdopen(os.dup(sys.stdin.fileno())))
    1.34 +
    1.35 +
    1.36 +if __name__ == '__main__':
    1.37 +  sys.exit(main())

mercurial