1#!/usr/bin/python
2
3# Copyright (c) 2009 Google Inc. 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
7import os.path
8import shutil
9import sys
10
11
12gyps = [
13    'app/app.gyp',
14    'base/base.gyp',
15    'build/temp_gyp/googleurl.gyp',
16    'build/all.gyp',
17    'build/common.gypi',
18    'build/external_code.gypi',
19    'chrome/test/security_tests/security_tests.gyp',
20    'chrome/third_party/hunspell/hunspell.gyp',
21    'chrome/chrome.gyp',
22    'media/media.gyp',
23    'net/net.gyp',
24    'printing/printing.gyp',
25    'sdch/sdch.gyp',
26    'skia/skia.gyp',
27    'testing/gmock.gyp',
28    'testing/gtest.gyp',
29    'third_party/bzip2/bzip2.gyp',
30    'third_party/icu38/icu38.gyp',
31    'third_party/libevent/libevent.gyp',
32    'third_party/libjpeg/libjpeg.gyp',
33    'third_party/libpng/libpng.gyp',
34    'third_party/libxml/libxml.gyp',
35    'third_party/libxslt/libxslt.gyp',
36    'third_party/lzma_sdk/lzma_sdk.gyp',
37    'third_party/modp_b64/modp_b64.gyp',
38    'third_party/npapi/npapi.gyp',
39    'third_party/sqlite/sqlite.gyp',
40    'third_party/zlib/zlib.gyp',
41    'v8/tools/gyp/v8.gyp',
42    'webkit/activex_shim/activex_shim.gyp',
43    'webkit/activex_shim_dll/activex_shim_dll.gyp',
44    'webkit/build/action_csspropertynames.py',
45    'webkit/build/action_cssvaluekeywords.py',
46    'webkit/build/action_jsconfig.py',
47    'webkit/build/action_makenames.py',
48    'webkit/build/action_maketokenizer.py',
49    'webkit/build/action_useragentstylesheets.py',
50    'webkit/build/rule_binding.py',
51    'webkit/build/rule_bison.py',
52    'webkit/build/rule_gperf.py',
53    'webkit/tools/test_shell/test_shell.gyp',
54    'webkit/webkit.gyp',
55]
56
57
58def Main(argv):
59  if len(argv) != 3 or argv[1] not in ['push', 'pull']:
60    print 'Usage: %s push/pull PATH_TO_CHROME' % argv[0]
61    return 1
62
63  path_to_chrome = argv[2]
64
65  for g in gyps:
66    chrome_file = os.path.join(path_to_chrome, g)
67    local_file = os.path.join(os.path.dirname(argv[0]), os.path.split(g)[1])
68    if argv[1] == 'push':
69      print 'Copying %s to %s' % (local_file, chrome_file)
70      shutil.copyfile(local_file, chrome_file)
71    elif argv[1] == 'pull':
72      print 'Copying %s to %s' % (chrome_file, local_file)
73      shutil.copyfile(chrome_file, local_file)
74    else:
75      assert False
76
77  return 0
78
79
80if __name__ == '__main__':
81  sys.exit(Main(sys.argv))
82