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

Unified Diff: build/util/remove_tree.py

Issue 23301019: Remove third_party/cld2 once (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« DEPS ('K') | « DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/util/remove_tree.py
diff --git a/build/util/remove_tree.py b/build/util/remove_tree.py
new file mode 100644
index 0000000000000000000000000000000000000000..1977834725d392235c06da80aa3b8a7bb66d7d1e
--- /dev/null
+++ b/build/util/remove_tree.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+remove_tree.py -- Remove the specified directory recursively
+"""
+
+import os
+import shutil
+import sys
+
+def main(argv=None):
Isaac (away) 2013/08/28 06:22:56 make option required
hajimehoshi 2013/08/28 06:47:15 Done.
+ if argv is None:
+ argv = sys.argv
Isaac (away) 2013/08/28 06:22:56 remove these lines
hajimehoshi 2013/08/28 06:47:15 Done.
+
+ if len(argv) != 2:
Isaac (away) 2013/08/28 06:22:56 return 'Usage: %s <PATH>' % os.path.basename(__fil
Isaac (away) 2013/08/28 06:24:18 Actually you should use: return 'Usage: %s <PATH>
hajimehoshi 2013/08/28 06:47:15 Done.
+ program = os.path.basename(__file__)
+ sys.stderr.write('Usage: ' + program + ' PATH\n')
+ sys.exit(1)
Isaac (away) 2013/08/28 06:22:56 remove these lines
hajimehoshi 2013/08/28 06:47:15 Done.
+
+ path = argv[1]
+ shutil.rmtree(path, True)
+
+ return 0
Isaac (away) 2013/08/28 06:22:56 Not needed, sys.exit(None) exits with zero, remove
hajimehoshi 2013/08/28 06:47:15 Done.
+
+if __name__ == '__main__':
+ sys.exit(main())
Isaac (away) 2013/08/28 06:22:56 pass sys.argv here
hajimehoshi 2013/08/28 06:47:15 Done.
« DEPS ('K') | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698