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

Side by Side 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, 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 unified diff | Download patch
« no previous file with comments | « chrome/BUILD.gn ('k') | 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
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import optparse
6 import os
7 import shutil
8 import sys
9
10
11 def CleanUpOldVersions(path_to_app, keep_version, stamp_path):
12 versions_dir = os.path.join(path_to_app, 'Contents', 'Versions')
13 for version in os.listdir(versions_dir):
14 if version != keep_version:
15 shutil.rmtree(os.path.join(versions_dir, version))
16
17 open(stamp_path, 'w').close()
18 os.utime(stamp_path, None)
19
20
21 def Main():
22 parser = optparse.OptionParser(
23 usage='%prog path/to/Chromium.app keep_version stamp_path')
24 opts, args = parser.parse_args()
25 if len(args) != 3:
26 parser.error('missing arguments')
27 return 1
28
29 CleanUpOldVersions(*args)
30 return 0
31
32 if __name__ == '__main__':
33 sys.exit(Main())
OLDNEW
« 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