aboutsummaryrefslogtreecommitdiff
path: root/auto_delete_nightly_test_data.py
diff options
context:
space:
mode:
authorCaroline Tice <cmtice@google.com>2016-01-13 09:48:29 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-01-22 19:30:55 +0000
commit88272d479f2761cc1906fea564c73033f77a6270 (patch)
tree4da9c114d64522f59494a908cf9a85b09c994d32 /auto_delete_nightly_test_data.py
parent439f2b77c86987362f53bd4f6e39896aa6d77f66 (diff)
downloadtoolchain-utils-88272d479f2761cc1906fea564c73033f77a6270.tar.gz
Fix cros lint errors.
Also move deprecated scripts to the 'deprecated' directory. BUG=chromiumos:570464 TEST=tested scripts to make sure they still work. Change-Id: I3442a86d898104591233a0849ea0bafb52ecf1f7 Reviewed-on: https://chrome-internal-review.googlesource.com/244221 Commit-Ready: Caroline Tice <cmtice@google.com> Tested-by: Caroline Tice <cmtice@google.com> Reviewed-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'auto_delete_nightly_test_data.py')
-rwxr-xr-xauto_delete_nightly_test_data.py39
1 files changed, 19 insertions, 20 deletions
diff --git a/auto_delete_nightly_test_data.py b/auto_delete_nightly_test_data.py
index e01cb08b..3652b270 100755
--- a/auto_delete_nightly_test_data.py
+++ b/auto_delete_nightly_test_data.py
@@ -5,15 +5,15 @@ from __future__ import print_function
__author__ = 'shenhan@google.com (Han Shen)'
+import argparse
import datetime
-import optparse
import os
import re
import sys
-from utils import command_executer
-from utils import constants
-from utils import misc
+from cros_utils import command_executer
+from cros_utils import constants
+from cros_utils import misc
DIR_BY_WEEKDAY = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')
@@ -72,28 +72,27 @@ def CleanDatedDir(dated_dir, dry_run=False):
def ProcessArguments(argv):
"""Process arguments."""
- parser = optparse.OptionParser(
+ parser = argparse.ArgumentParser(
description='Automatically delete nightly test data directories.',
usage='auto_delete_nightly_test_data.py options')
- parser.add_option('-d',
- '--dry_run',
- dest='dry_run',
- default=False,
- action='store_true',
- help='Only print command line, do not execute anything.')
- parser.add_option('--days_to_preserve',
- dest='days_to_preserve',
- default=3,
- help=('Specify the number of days (not including today), '
- 'test data generated on these days will *NOT* be '
- 'deleted. Defaults to 3.'))
- options, _ = parser.parse_args(argv)
+ parser.add_argument('-d',
+ '--dry_run',
+ dest='dry_run',
+ default=False,
+ action='store_true',
+ help='Only print command line, do not execute anything.')
+ parser.add_argument('--days_to_preserve',
+ dest='days_to_preserve',
+ default=3,
+ help=('Specify the number of days (not including today),'
+ ' test data generated on these days will *NOT* be '
+ 'deleted. Defaults to 3.'))
+ options = parser.parse_args(argv)
return options
def CleanChromeOsTmpAndImages():
"""Delete temporaries, images under crostc/chromeos."""
-
chromeos_chroot_tmp = os.path.join(constants.CROSTC_WORKSPACE, 'chromeos',
'chroot', 'tmp')
@@ -158,5 +157,5 @@ def Main(argv):
if __name__ == '__main__':
- retval = Main(sys.argv)
+ retval = Main(sys.argv[1:])
sys.exit(retval)