OLD | NEW |
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """ | 5 """ |
6 This module helps emulate Visual Studio 2008 behavior on top of other | 6 This module helps emulate Visual Studio 2008 behavior on top of other |
7 build systems, primarily ninja. | 7 build systems, primarily ninja. |
8 """ | 8 """ |
9 | 9 |
10 import os | 10 import os |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 if '$' in string: | 823 if '$' in string: |
824 for old, new in expansions.iteritems(): | 824 for old, new in expansions.iteritems(): |
825 assert '$(' not in new, new | 825 assert '$(' not in new, new |
826 string = string.replace(old, new) | 826 string = string.replace(old, new) |
827 return string | 827 return string |
828 | 828 |
829 def _ExtractImportantEnvironment(output_of_set): | 829 def _ExtractImportantEnvironment(output_of_set): |
830 """Extracts environment variables required for the toolchain to run from | 830 """Extracts environment variables required for the toolchain to run from |
831 a textual dump output by the cmd.exe 'set' command.""" | 831 a textual dump output by the cmd.exe 'set' command.""" |
832 envvars_to_save = ( | 832 envvars_to_save = ( |
833 'goma_.*', # TODO(scottmg): This is ugly, but needed for goma. | 833 'goma_.*', # TODO(scottmg): This is ugly, but needed for goma. |
834 'include', | 834 'include', |
835 'lib', | 835 'lib', |
836 'libpath', | 836 'libpath', |
837 'path', | 837 'path', |
838 'pathext', | 838 'pathext', |
839 'systemroot', | 839 'systemroot', |
840 'temp', | 840 'temp', |
841 'tmp', | 841 'tmp', |
| 842 |
| 843 # Needed to pass through some chrome flags. |
| 844 # http://crbug.com/333738. |
| 845 'chrom.*', |
| 846 'official_build', |
842 ) | 847 ) |
843 env = {} | 848 env = {} |
844 for line in output_of_set.splitlines(): | 849 for line in output_of_set.splitlines(): |
845 for envvar in envvars_to_save: | 850 for envvar in envvars_to_save: |
846 if re.match(envvar + '=', line.lower()): | 851 if re.match(envvar + '=', line.lower()): |
847 var, setting = line.split('=', 1) | 852 var, setting = line.split('=', 1) |
848 if envvar == 'path': | 853 if envvar == 'path': |
849 # Our own rules (for running gyp-win-tool) and other actions in | 854 # Our own rules (for running gyp-win-tool) and other actions in |
850 # Chromium rely on python being in the path. Add the path to this | 855 # Chromium rely on python being in the path. Add the path to this |
851 # python here so that if it's not in the path when ninja is run | 856 # python here so that if it's not in the path when ninja is run |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 | 955 |
951 # To determine processor word size on Windows, in addition to checking | 956 # To determine processor word size on Windows, in addition to checking |
952 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current | 957 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current |
953 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which | 958 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which |
954 # contains the actual word size of the system when running thru WOW64). | 959 # contains the actual word size of the system when running thru WOW64). |
955 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or | 960 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or |
956 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): | 961 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): |
957 default_variables['MSVS_OS_BITS'] = 64 | 962 default_variables['MSVS_OS_BITS'] = 64 |
958 else: | 963 else: |
959 default_variables['MSVS_OS_BITS'] = 32 | 964 default_variables['MSVS_OS_BITS'] = 32 |
OLD | NEW |