OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 Google Inc. 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 Verifies that make_global_settings can be used to override the |
| 7 compiler settings. |
| 8 """ |
| 9 |
| 10 import TestGyp |
| 11 import os |
| 12 import copy |
| 13 import sys |
| 14 from string import Template |
| 15 |
| 16 if sys.platform == 'win32': |
| 17 formats = ['make'] |
| 18 else: |
| 19 formats = ['ninja', 'make'] |
| 20 |
| 21 test = TestGyp.TestGyp(formats=formats) |
| 22 |
| 23 gypfile = 'compiler-global-settings.gyp' |
| 24 |
| 25 replacements = { 'PYTHON': '/usr/bin/python', 'PWD': os.getcwd()} |
| 26 |
| 27 # Process the .in gyp file to produce the final gyp file |
| 28 # since we need to include absolute paths in the make_global_settings |
| 29 # section. |
| 30 replacements['TOOLSET'] = 'target' |
| 31 s = Template(open(gypfile + '.in').read()) |
| 32 output = open(gypfile, 'w') |
| 33 output.write(s.substitute(replacements)) |
| 34 output.close() |
| 35 |
| 36 test.run_gyp(gypfile) |
| 37 test.build(gypfile) |
| 38 test.must_contain_all_lines(test.stdout(), ['my_cc.py', 'my_cxx.py', 'FOO']) |
| 39 |
| 40 # Same again but with the host toolset. |
| 41 replacements['TOOLSET'] = 'host' |
| 42 s = Template(open(gypfile + '.in').read()) |
| 43 output = open(gypfile, 'w') |
| 44 output.write(s.substitute(replacements)) |
| 45 output.close() |
| 46 |
| 47 test.run_gyp(gypfile) |
| 48 test.build(gypfile) |
| 49 test.must_contain_all_lines(test.stdout(), ['my_cc.py', 'my_cxx.py', 'BAR']) |
| 50 |
| 51 test.pass_test() |
OLD | NEW |