diff options
Diffstat (limited to 'src/scripts/cleanup.py')
-rwxr-xr-x | src/scripts/cleanup.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/scripts/cleanup.py b/src/scripts/cleanup.py index f14f6d9c1..ae2f588f5 100755 --- a/src/scripts/cleanup.py +++ b/src/scripts/cleanup.py @@ -43,10 +43,7 @@ def remove_all_in_dir(d): for f in os.listdir(d): remove_file(os.path.join(d, f)) -def main(args=None): - if args is None: - args = sys.argv - +def parse_options(args): parser = optparse.OptionParser() parser.add_option('--build-dir', default='build', metavar='DIR', help='specify build dir to clean (default %default)') @@ -58,14 +55,21 @@ def main(args=None): (options, args) = parser.parse_args(args) + if len(args) > 1: + raise Exception("Unknown arguments") + + return options + +def main(args=None): + if args is None: + args = sys.argv + + options = parse_options(args) + logging.basicConfig(stream=sys.stderr, format='%(levelname) 7s: %(message)s', level=logging.DEBUG if options.verbose else logging.INFO) - if len(args) > 1: - logging.error("Unknown arguments") - return 1 - build_dir = options.build_dir if os.access(build_dir, os.X_OK) != True: @@ -101,8 +105,6 @@ def main(args=None): except OSError: pass - #remove_file(build_config['doc_stamp_file']) - remove_file(build_config['cli_exe']) remove_file(build_config['test_exe']) |