Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright 2014 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 """Wrapper script for `gclient runhooks`. | |
| 7 | |
| 8 This is useful to set slave-dependent gyp defines. | |
| 9 """ | |
| 10 | |
| 11 import optparse | |
| 12 import os | |
| 13 import sys | |
| 14 | |
| 15 from common import chromium_utils | |
| 16 | |
| 17 | |
| 18 # Path of the scripts/slave/ checkout on the slave, found by looking at the | |
| 19 # current runhooks_wrapper.py script's path's dirname(). | |
| 20 SLAVE_SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__)) | |
| 21 # Path of the build/ checkout on the slave, found relative to the | |
| 22 # scripts/slave/ directory. | |
| 23 BUILD_DIR = os.path.dirname(os.path.dirname(SLAVE_SCRIPTS_DIR)) | |
|
iannucci
2014/04/15 18:45:29
can we put an os.path.abspath(...) around this?
Nico
2014/04/15 18:56:43
This is copypasta'd from compile.py. The SLAVE_SCR
| |
| 24 | |
| 25 | |
| 26 def main(): | |
| 27 parser = optparse.OptionParser(description=__doc__) | |
| 28 parser.add_option('--use-goma', action='store_true') | |
| 29 parser.add_option('--goma-dir', | |
| 30 default=os.path.join(BUILD_DIR, 'goma'), | |
| 31 help='goma directory, only used if --use-goma is passed') | |
| 32 options, args = parser.parse_args() | |
| 33 assert not args | |
| 34 | |
| 35 if options.use_goma: | |
| 36 # Add goma-related GYP_DEFINES if requested. This is done in a slave script | |
| 37 # because goma_dir is a slave-relative path and is not known to the master. | |
| 38 gyp_defines = os.environ.get('GYP_DEFINES', '') | |
|
iannucci
2014/04/15 18:45:29
should we check this to ensure it doesn't already
Nico
2014/04/15 18:56:43
I think it doesn't matter much. No master currentl
| |
| 39 gyp_defines += ' use_goma=1 gomadir=' + options.goma_dir | |
|
iannucci
2014/04/15 18:45:29
IIRC, gomadir needs stupid quoting on windows. I b
Nico
2014/04/15 18:56:43
Oh right, good catch! Done.
| |
| 40 os.environ['GYP_DEFINES'] = gyp_defines | |
| 41 print 'Changed GYP_DEFINES to', os.environ['GYP_DEFINES'] | |
| 42 | |
| 43 return chromium_utils.RunCommand(['gclient', 'runhooks']) | |
| 44 | |
| 45 | |
| 46 if '__main__' == __name__: | |
| 47 sys.exit(main()) | |
| OLD | NEW |