1 #!/usr/bin/env python 2 3 # Copyright (c) 2012 The Chromium Authors. 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 import os 8 import subprocess 9 import sys 10 11 _GYP_REVISION = '1344' 12 _GYP_FETCH_URL = 'https://gyp.googlecode.com/svn/trunk@' + _GYP_REVISION 13 14 def _fetch_gyp(): 15 gyp_dir = os.path.join('third_party', 'gyp') 16 if not os.path.exists(gyp_dir): 17 retcode = subprocess.call(['svn', 'checkout', _GYP_FETCH_URL, gyp_dir]) 18 if retcode < 0: 19 raise "Couldn't fetch gyp" 20 # TODO(bashi): Check revision, etc 21 sys.path.insert(0, os.path.abspath(os.path.join(gyp_dir, 'pylib'))) 22 23 def main(): 24 script_dir = os.path.abspath(os.path.dirname(__file__)) 25 os.chdir(script_dir) 26 _fetch_gyp() 27 import gyp 28 29 args = [] 30 args.extend(['--depth', '.']) 31 args.extend(sys.argv[1:]) 32 args.append(os.path.join(script_dir, 'ots-standalone.gyp')) 33 sys.exit(gyp.main(args)) 34 35 if __name__ == '__main__': 36 main() 37