Chromium Code Reviews| Index: build/gyp_chromium |
| diff --git a/build/gyp_chromium b/build/gyp_chromium |
| index 34860c70ad0a9501243dcf9e68f30066104fe45d..319574eaca44bfeb17f665eec16972be1b97cdef 100755 |
| --- a/build/gyp_chromium |
| +++ b/build/gyp_chromium |
| @@ -62,6 +62,21 @@ def GetSupplementalFiles(): |
| return glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) |
| +def FormatKeyForGN(key): |
| + """Returns the given GYP key reformatted for GN. |
| + |
| + GYP dictionary keys can be almost anything, but in GN they are identifiers |
| + and must follow the same rules. This reformats such keys to be valid GN |
| + identifiers.""" |
| + ret = '' |
| + for c in key: |
| + if (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z'): |
|
Nico
2013/12/04 18:15:20
if c in string.ascii_letters, and add `import stri
|
| + ret = ret + c |
|
Nico
2013/12/04 18:15:20
ret += c
|
| + else: |
| + ret = ret + '_' |
|
Nico
2013/12/04 18:15:20
ret += '_'
|
| + return ret |
|
Nico
2013/12/04 18:15:20
I think the "more pythonic" way of writing this is
|
| + |
| + |
| def GetVarsStringForGN(supplemental_files): |
| vars_dict = {} |
| @@ -81,7 +96,7 @@ def GetVarsStringForGN(supplemental_files): |
| for item in items: |
| tokens = item.split('=', 1) |
| # Some GYP variables have hyphens, which we don't support. |
| - key = tokens[0].replace("-", "_") |
| + key = FormatKeyForGN(tokens[0]) |
| if len(tokens) == 2: |
| # Escape $ characters which have special meaning to GN. |
| vars_dict[key] = '"' + tokens[1].replace("$", "\\$") + '"' |
| @@ -206,10 +221,8 @@ if __name__ == '__main__': |
| supplemental_includes = GetSupplementalFiles() |
| - # Temporarily disabled until it is debugged. |
| - # TODO(brettw) re-enable this code. |
| - #if not RunGN(supplemental_includes): |
| - # sys.exit(1) |
| + if not RunGN(supplemental_includes): |
| + sys.exit(1) |
| args.extend( |
| ['-I' + i for i in additional_include_files(supplemental_includes, args)]) |