Chromium Code Reviews| Index: build/check_gn_headers.py |
| diff --git a/build/check_gn_headers.py b/build/check_gn_headers.py |
| index fe884db6cb0b8e8253d5be3ac91d59d1c4290211..f3953704d95e1b69acb06e998a9e6542879d073d 100755 |
| --- a/build/check_gn_headers.py |
| +++ b/build/check_gn_headers.py |
| @@ -48,7 +48,8 @@ def ParseNinjaDepsOutput(ninja_out): |
| """Parse ninja output and get the header files""" |
| all_headers = set() |
| - prefix = '..' + os.sep + '..' + os.sep |
| + # Ninja always use "/", even on Windows. |
|
brucedawson
2017/06/12 17:38:40
use-> uses
wychen
2017/06/12 21:45:45
Done.
|
| + prefix = '../../' |
| is_valid = False |
| for line in ninja_out: |
| @@ -76,11 +77,14 @@ def GetHeadersFromGN(out_dir, q): |
| tmp = None |
| ans, err = set(), None |
| try: |
| - tmp = tempfile.mkdtemp() |
| + # Argument |dir| is needed to make sure it's on the same drive on Windows. |
| + # dir='' means dir='.', but doesn't introduce an unneeded prefix. |
| + tmp = tempfile.mkdtemp(dir='') |
| shutil.copy2(os.path.join(out_dir, 'args.gn'), |
| os.path.join(tmp, 'args.gn')) |
| # Do "gn gen" in a temp dir to prevent dirtying |out_dir|. |
| - subprocess.check_call(['gn', 'gen', tmp, '--ide=json', '-q']) |
| + GN_EXE = 'gn.bat' if sys.platform == 'win32' else 'gn' |
|
brucedawson
2017/06/12 17:38:40
Why upper-case for GN_EXE and GCLIENT_EXE? Doesn't
wychen
2017/06/12 21:45:45
Done.
|
| + subprocess.check_call([GN_EXE, 'gen', tmp, '--ide=json', '-q']) |
| gn_json = json.load(open(os.path.join(tmp, 'project.json'))) |
| ans = ParseGNProjectJSON(gn_json, out_dir, tmp) |
| except Exception as e: |
| @@ -116,9 +120,11 @@ def GetDepsPrefixes(q): |
| """Return all the folders controlled by DEPS file""" |
| prefixes, err = set(), None |
| try: |
| + GCLIENT_EXE = 'gclient.bat' if sys.platform == 'win32' else 'gclient' |
| gclient_out = subprocess.check_output( |
| - ['gclient', 'recurse', '--no-progress', '-j1', |
| - 'python', '-c', 'import os;print os.environ["GCLIENT_DEP_PATH"]']) |
| + [GCLIENT_EXE, 'recurse', '--no-progress', '-j1', |
| + 'python', '-c', 'import os;print os.environ["GCLIENT_DEP_PATH"]'], |
| + universal_newlines = True) |
| for i in gclient_out.split('\n'): |
| if i.startswith('src/'): |
| i = i[4:] |