[jhbuild/release-team-commands: 4/6] possibility to pass checks on the command line
- From: Frederic Peters <fpeters src gnome org>
- To: svn-commits-list gnome org
- Subject: [jhbuild/release-team-commands: 4/6] possibility to pass checks on the command line
- Date: Mon, 4 May 2009 05:29:04 -0400 (EDT)
commit f0d2889a41b12f95052a32336bd29788635bc122
Author: Frederic Peters <fpeters 0d be>
Date: Mon May 4 11:20:27 2009 +0200
possibility to pass checks on the command line
Example: jhbuild goalreport --check SymbolsCheck:g_timeout_add -o t.html
---
jhbuild/commands/goalreport.py | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/jhbuild/commands/goalreport.py b/jhbuild/commands/goalreport.py
index e88a2db..d28ac02 100644
--- a/jhbuild/commands/goalreport.py
+++ b/jhbuild/commands/goalreport.py
@@ -21,6 +21,7 @@ import os
import re
import sys
import subprocess
+import types
import cPickle
from optparse import make_option
try:
@@ -129,6 +130,10 @@ class Check:
return
self.status = 'ok'
+ def create_from_args(cls, *args):
+ pass
+ create_from_args = classmethod(create_from_args)
+
class ShellCheck(Check):
cmd = None
@@ -200,6 +205,11 @@ class SymbolsCheck(Check):
self.bad_symbols.remove(symbol)
self.compute_status()
+ def create_from_args(cls, *args):
+ new_class = types.ClassType('SymbolsCheck (%s)' % ', '.join(args),
+ (cls,), {'symbols': args})
+ return new_class
+ create_from_args = classmethod(create_from_args)
class DeprecatedSymbolsCheck(SymbolsCheck):
@@ -246,8 +256,21 @@ class cmd_goalreport(Command):
action='store_true', dest='nocache', default=False),
make_option('--all-modules',
action='store_true', dest='list_all_modules', default=False),
+ make_option('--check', metavar='CHECK',
+ action='append', dest='checks', default=[],
+ help=_('check to perform')),
])
+ def load_checks_from_options(self, checks):
+ self.checks = []
+ for check_option in checks:
+ check_class_name, args = check_option.split(':', 2)
+ args = args.split(':')
+ check_base_class = globals().get(check_class_name)
+ check = check_base_class.create_from_args(*args)
+ self.checks.append(check)
+
+
def run(self, config, options, args):
if options.output:
output = StringIO()
@@ -263,6 +286,9 @@ class cmd_goalreport(Command):
self.load_bugs(options.bugfile)
self.load_false_positives(options.falsepositivesfile)
+ if not self.checks:
+ self.load_checks_from_options(options.checks)
+
config.devhelp_dirname = options.devhelp_dirname
module_set = jhbuild.moduleset.load(config)
@@ -511,12 +537,14 @@ class cmd_goalreport(Command):
# $(module)/$(checkname) $(bugnumber)
# Sample bug file:
# evolution/LibGnomeCanvas 571742
+ self.bugs = {}
+ if not filename:
+ return
if filename.startswith('http://'):
try:
filename = httpcache.load(filename, age=0)
except Exception, e:
raise FatalError(_('could not download %s: %s') % (filename, e))
- self.bugs = {}
for line in file(filename):
line = line.strip()
if not line:
@@ -540,12 +568,14 @@ class cmd_goalreport(Command):
self.bug_status[bug_id] = bug_resolved
def load_false_positives(self, filename):
+ self.false_positives = {}
+ if not filename:
+ return
if filename.startswith('http://'):
try:
filename = httpcache.load(filename, age=0)
except Exception, e:
raise FatalError(_('could not download %s: %s') % (filename, e))
- self.false_positives = {}
for line in file(filename):
line = line.strip()
if not line:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]