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

Unified Diff: chrome/tools/build/mac/clean_up_old_versions.py

Issue 2179013002: [Mac/GN] Clean up old version folders in Chromium.app/Contents/Versions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: os.utime Created 4 years, 5 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
« no previous file with comments | « chrome/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/tools/build/mac/clean_up_old_versions.py
diff --git a/chrome/tools/build/mac/clean_up_old_versions.py b/chrome/tools/build/mac/clean_up_old_versions.py
new file mode 100644
index 0000000000000000000000000000000000000000..91ab4bad7a8ebd33a9f8bb29a5c3a7eb088f1e7b
--- /dev/null
+++ b/chrome/tools/build/mac/clean_up_old_versions.py
@@ -0,0 +1,33 @@
+# Copyright 2016 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.
+
+import optparse
+import os
+import shutil
+import sys
+
+
+def CleanUpOldVersions(path_to_app, keep_version, stamp_path):
+ versions_dir = os.path.join(path_to_app, 'Contents', 'Versions')
+ for version in os.listdir(versions_dir):
+ if version != keep_version:
+ shutil.rmtree(os.path.join(versions_dir, version))
+
+ open(stamp_path, 'w').close()
+ os.utime(stamp_path, None)
+
+
+def Main():
+ parser = optparse.OptionParser(
+ usage='%prog path/to/Chromium.app keep_version stamp_path')
+ opts, args = parser.parse_args()
+ if len(args) != 3:
+ parser.error('missing arguments')
+ return 1
+
+ CleanUpOldVersions(*args)
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(Main())
« no previous file with comments | « chrome/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698