From 628e22b357c0561abb0d3c09b0debe119853524d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 31 Mar 2009 22:16:51 +0000 Subject: [PATCH] Add parsing code for --jobs and --load-average. svn path=/main/trunk/; revision=13263 --- bin/egencache | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/bin/egencache b/bin/egencache index e8981deba..c7b73c98c 100755 --- a/bin/egencache +++ b/bin/egencache @@ -56,6 +56,37 @@ def parse_args(args): parser.error('No action specified (--update ' + \ 'is the only available action)') + if options.jobs: + jobs = None + try: + jobs = int(options.jobs) + except ValueError: + jobs = -1 + + if jobs < 1: + parser.error("Invalid: --jobs='%s'" % \ + (options.jobs,)) + + options.jobs = jobs + + else: + options.jobs = None + + if options.load_average: + try: + load_average = float(options.load_average) + except ValueError: + load_average = 0.0 + + if load_average <= 0.0: + parser.error("Invalid: --load-average='%s'" % \ + (options.load_average,)) + + options.load_average = load_average + + else: + options.load_average = None + if options.config_root is not None and \ not os.path.isdir(options.config_root): parser.error("Not a directory: --config-root='%s'" % \ -- 2.26.2