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

Side by Side Diff: build/rmdir_and_stamp.py

Issue 1676913002: [mojo] Delete third_party/mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: let's try that again Created 4 years, 10 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 | « build/gn_migration.gypi ('k') | chrome/browser/BUILD.gn » ('j') | 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 (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """Wipes out a directory recursively and then touches a stamp file. 6 """Wipes out a directory recursively and then touches a stamp file.
7 7
8 This odd pairing of operations is used to support build scripts which 8 This odd pairing of operations is used to support build scripts which
9 slurp up entire directories (e.g. build/android/javac.py when handling 9 slurp up entire directories (e.g. build/android/javac.py when handling
10 generated sources) as inputs. 10 generated sources) as inputs.
11 11
12 The general pattern of use is: 12 The general pattern of use is:
13 13
14 - Add a target which generates |gen_sources| into |out_path| from |inputs|. 14 - Add a target which generates |gen_sources| into |out_path| from |inputs|.
15 - Include |stamp_file| as an input for that target or any of its rules which 15 - Include |stamp_file| as an input for that target or any of its rules which
16 generate files in |out_path|. 16 generate files in |out_path|.
17 - Add an action which depends on |inputs| and which outputs |stamp_file|; 17 - Add an action which depends on |inputs| and which outputs |stamp_file|;
18 the action should run this script and pass |out_path| and |stamp_file| as 18 the action should run this script and pass |out_path| and |stamp_file| as
19 its arguments. 19 its arguments.
20 20
21 The net result is that you will force |out_path| to be wiped and all 21 The net result is that you will force |out_path| to be wiped and all
22 |gen_sources| to be regenerated any time any file in |inputs| changes. 22 |gen_sources| to be regenerated any time any file in |inputs| changes.
23 23
24 See //third_party/mojo/mojom_bindings_generator.gypi for an example use case. 24 See //mojo/mojom_bindings_generator.gypi for an example use case.
25 25
26 """ 26 """
27 27
28 import errno 28 import errno
29 import os 29 import os
30 import shutil 30 import shutil
31 import sys 31 import sys
32 32
33 33
34 def Main(dst_dir, stamp_file): 34 def Main(dst_dir, stamp_file):
35 try: 35 try:
36 shutil.rmtree(os.path.normpath(dst_dir)) 36 shutil.rmtree(os.path.normpath(dst_dir))
37 except OSError as e: 37 except OSError as e:
38 # Ignore only "not found" errors. 38 # Ignore only "not found" errors.
39 if e.errno != errno.ENOENT: 39 if e.errno != errno.ENOENT:
40 raise e 40 raise e
41 with open(stamp_file, 'a'): 41 with open(stamp_file, 'a'):
42 os.utime(stamp_file, None) 42 os.utime(stamp_file, None)
43 43
44 if __name__ == '__main__': 44 if __name__ == '__main__':
45 sys.exit(Main(sys.argv[1], sys.argv[2])) 45 sys.exit(Main(sys.argv[1], sys.argv[2]))
OLDNEW
« no previous file with comments | « build/gn_migration.gypi ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698