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 from compiler.ast import Const | 5 from compiler.ast import Const |
6 from compiler.ast import Dict | 6 from compiler.ast import Dict |
7 from compiler.ast import Discard | 7 from compiler.ast import Discard |
8 from compiler.ast import List | 8 from compiler.ast import List |
9 from compiler.ast import Module | 9 from compiler.ast import Module |
10 from compiler.ast import Node | 10 from compiler.ast import Node |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 # These per-process dictionaries are used to cache build file data when loading | 51 # These per-process dictionaries are used to cache build file data when loading |
52 # in parallel mode. | 52 # in parallel mode. |
53 per_process_data = {} | 53 per_process_data = {} |
54 per_process_aux_data = {} | 54 per_process_aux_data = {} |
55 | 55 |
56 def IsPathSection(section): | 56 def IsPathSection(section): |
57 # If section ends in one of the '=+?!' characters, it's applied to a section | 57 # If section ends in one of the '=+?!' characters, it's applied to a section |
58 # without the trailing characters. '/' is notably absent from this list, | 58 # without the trailing characters. '/' is notably absent from this list, |
59 # because there's no way for a regular expression to be treated as a path. | 59 # because there's no way for a regular expression to be treated as a path. |
60 while section[-1:] in '=+?!': | 60 while section and section[-1:] in '=+?!': |
61 section = section[:-1] | 61 section = section[:-1] |
62 | 62 |
63 if section in path_sections: | 63 if section in path_sections: |
64 return True | 64 return True |
65 | 65 |
66 # Sections mathing the regexp '_(dir|file|path)s?$' are also | 66 # Sections mathing the regexp '_(dir|file|path)s?$' are also |
67 # considered PathSections. Using manual string matching since that | 67 # considered PathSections. Using manual string matching since that |
68 # is much faster than the regexp and this can be called hundreds of | 68 # is much faster than the regexp and this can be called hundreds of |
69 # thousands of times so micro performance matters. | 69 # thousands of times so micro performance matters. |
70 if "_" in section: | 70 if "_" in section: |
(...skipping 2808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2879 ValidateRunAsInTarget(target, target_dict, build_file) | 2879 ValidateRunAsInTarget(target, target_dict, build_file) |
2880 ValidateActionsInTarget(target, target_dict, build_file) | 2880 ValidateActionsInTarget(target, target_dict, build_file) |
2881 | 2881 |
2882 # Generators might not expect ints. Turn them into strs. | 2882 # Generators might not expect ints. Turn them into strs. |
2883 TurnIntIntoStrInDict(data) | 2883 TurnIntIntoStrInDict(data) |
2884 | 2884 |
2885 # TODO(mark): Return |data| for now because the generator needs a list of | 2885 # TODO(mark): Return |data| for now because the generator needs a list of |
2886 # build files that came in. In the future, maybe it should just accept | 2886 # build files that came in. In the future, maybe it should just accept |
2887 # a list, and not the whole data dict. | 2887 # a list, and not the whole data dict. |
2888 return [flat_list, targets, data] | 2888 return [flat_list, targets, data] |
OLD | NEW |