aboutsummaryrefslogtreecommitdiff
path: root/gyp_ots
blob: 9a4056e054f05316fbc98b23fee18a4c70ba15d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python

# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os
import subprocess
import sys

_GYP_REVISION = '1344'
_GYP_FETCH_URL = 'https://gyp.googlecode.com/svn/trunk@' + _GYP_REVISION

def _fetch_gyp():
  gyp_dir = os.path.join('third_party', 'gyp')
  if not os.path.exists(gyp_dir):
    retcode = subprocess.call(['svn', 'checkout', _GYP_FETCH_URL, gyp_dir])
    if retcode < 0:
      raise "Couldn't fetch gyp"
  # TODO(bashi): Check revision, etc
  sys.path.insert(0, os.path.abspath(os.path.join(gyp_dir, 'pylib')))

def main():
  script_dir = os.path.abspath(os.path.dirname(__file__))
  os.chdir(script_dir)
  _fetch_gyp()
  import gyp

  args = []
  args.extend(['--depth', '.'])
  args.extend(sys.argv[1:])
  args.append(os.path.join(script_dir, 'ots-standalone.gyp'))
  sys.exit(gyp.main(args))

if __name__ == '__main__':
  main()