blob: 21d462c670a6e307a82ee65e115432f165628f91 [file] [log] [blame]
# 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')
if os.path.exists(versions_dir):
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/ keep_version stamp_path')
opts, args = parser.parse_args()
if len(args) != 3:
parser.error('missing arguments')
return 1
return 0
if __name__ == '__main__':