OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. 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 """ Set of basic operations/utilities that are used by the build. """ | 5 """ Set of basic operations/utilities that are used by the build. """ |
6 | 6 |
7 from contextlib import contextmanager | 7 from contextlib import contextmanager |
8 import ast | 8 import ast |
9 import base64 | 9 import base64 |
10 import cStringIO | 10 import cStringIO |
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1439 json.dumps(obj or {}, sort_keys=True, separators=(',', ':')), 9)) | 1439 json.dumps(obj or {}, sort_keys=True, separators=(',', ':')), 9)) |
1440 | 1440 |
1441 | 1441 |
1442 def convert_gz_json(option, _, value, parser): | 1442 def convert_gz_json(option, _, value, parser): |
1443 """Provide an OptionParser callback to unmarshal a b64 gz JSON string.""" | 1443 """Provide an OptionParser callback to unmarshal a b64 gz JSON string.""" |
1444 setattr( | 1444 setattr( |
1445 parser.values, option.dest, | 1445 parser.values, option.dest, |
1446 json.loads(zlib.decompress(base64.b64decode(value)))) | 1446 json.loads(zlib.decompress(base64.b64decode(value)))) |
1447 | 1447 |
1448 | 1448 |
1449 def convert_gz_json_type(value): | |
1450 """Provide an OptionParser callback to unmarshal a b64 gz JSON string.""" | |
1451 return json.loads(zlib.decompress(base64.b64decode(value))) | |
iannucci
2015/12/01 02:12:46
why does this have the same docstring as the funct
dnj
2015/12/01 02:39:09
Copy/paste :/
| |
1452 | |
1453 | |
1449 def SafeTranslate(inputstr): | 1454 def SafeTranslate(inputstr): |
1450 """Convert a free form string to one that can be used in a path. | 1455 """Convert a free form string to one that can be used in a path. |
1451 | 1456 |
1452 This is similar to the safeTranslate function in buildbot. | 1457 This is similar to the safeTranslate function in buildbot. |
1453 """ | 1458 """ |
1454 | 1459 |
1455 badchars_map = string.maketrans('\t !#$%&\'()*+,./:;<=>?@[\\]^{|}~', | 1460 badchars_map = string.maketrans('\t !#$%&\'()*+,./:;<=>?@[\\]^{|}~', |
1456 '______________________________') | 1461 '______________________________') |
1457 if isinstance(inputstr, unicode): | 1462 if isinstance(inputstr, unicode): |
1458 inputstr = inputstr.encode('utf8') | 1463 inputstr = inputstr.encode('utf8') |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1959 return False | 1964 return False |
1960 # Matches e.g. "cl_x86 = path/to/clang-cl.exe" | 1965 # Matches e.g. "cl_x86 = path/to/clang-cl.exe" |
1961 clang_cl_re = re.compile( | 1966 clang_cl_re = re.compile( |
1962 r'^cl_x\d\d\s+\=\s+(?P<compiler_path>[^ ]+)\s.*$', | 1967 r'^cl_x\d\d\s+\=\s+(?P<compiler_path>[^ ]+)\s.*$', |
1963 re.VERBOSE) | 1968 re.VERBOSE) |
1964 for line in open(build_file): | 1969 for line in open(build_file): |
1965 m = clang_cl_re.match(line) | 1970 m = clang_cl_re.match(line) |
1966 if m: | 1971 if m: |
1967 return 'clang' in m.group('compiler_path') | 1972 return 'clang' in m.group('compiler_path') |
1968 return False | 1973 return False |
OLD | NEW |