Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: build/clobber.py

Issue 2642833002: Don't clobber symlinks to build directories (Closed)
Patch Set: Disable on Windows too Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """This script provides methods for clobbering build directories.""" 6 """This script provides methods for clobbering build directories."""
7 7
8 import argparse 8 import argparse
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 19 matching lines...) Expand all
30 line = f.readline() 30 line = f.readline()
31 if len(line) == 0: 31 if len(line) == 0:
32 return '' # Unexpected EOF. 32 return '' # Unexpected EOF.
33 result += line 33 result += line
34 if line[0] == '\n': 34 if line[0] == '\n':
35 num_blank_lines = num_blank_lines + 1 35 num_blank_lines = num_blank_lines + 1
36 return result 36 return result
37 37
38 38
39 def delete_dir(build_dir): 39 def delete_dir(build_dir):
40 if os.path.islink(build_dir):
41 return
40 # For unknown reasons (anti-virus?) rmtree of Chromium build directories 42 # For unknown reasons (anti-virus?) rmtree of Chromium build directories
41 # often fails on Windows. 43 # often fails on Windows.
42 if sys.platform.startswith('win'): 44 if sys.platform.startswith('win'):
43 subprocess.check_call(['rmdir', '/s', '/q', build_dir], shell=True) 45 subprocess.check_call(['rmdir', '/s', '/q', build_dir], shell=True)
44 else: 46 else:
45 shutil.rmtree(build_dir) 47 shutil.rmtree(build_dir)
46 48
47 49
48 def delete_build_dir(build_dir): 50 def delete_build_dir(build_dir):
49 # GN writes a build.ninja.d file. Note that not all GN builds have args.gn. 51 # GN writes a build.ninja.d file. Note that not all GN builds have args.gn.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 def main(): 123 def main():
122 parser = argparse.ArgumentParser() 124 parser = argparse.ArgumentParser()
123 parser.add_argument('out_dir', help='The output directory to clobber') 125 parser.add_argument('out_dir', help='The output directory to clobber')
124 args = parser.parse_args() 126 args = parser.parse_args()
125 clobber(args.out_dir) 127 clobber(args.out_dir)
126 return 0 128 return 0
127 129
128 130
129 if __name__ == '__main__': 131 if __name__ == '__main__':
130 sys.exit(main()) 132 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698