From 6c9bf7d92a0df257cfae99108b3e6726f8017a84 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 22 Sep 2008 18:05:49 +0000 Subject: [PATCH] scan-view: Update for "button" class change, drop magic resolution of "scanview.css", start action for opening files. llvm-svn: 56448 --- clang/tools/scan-view/ScanView.py | 32 ++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/clang/tools/scan-view/ScanView.py b/clang/tools/scan-view/ScanView.py index 1606a8ddf620..e9ed40e6b3df 100644 --- a/clang/tools/scan-view/ScanView.py +++ b/clang/tools/scan-view/ScanView.py @@ -18,8 +18,11 @@ import ConfigParser kReportColRE = re.compile('') kReportColRepl = '' +#' kReportBugRE = re.compile('') -kReportBugRepl = 'Report Bug' +kReportBugRepl = 'Report Bug' +# + +# 'Open File') kBugKeyValueRE = re.compile('') kReportReplacements = [(kReportColRE, kReportColRepl), @@ -314,6 +317,29 @@ Submit """%locals() return self.send_string(result) + def send_open_report(self, report): + try: + keys = self.load_report(report) + except IOError: + return self.send_error(400, 'Invalid report.') + + file = keys.get('FILE') + if not file or not posixpath.exists(file): + return self.send_error(400, 'File does not exist: "%s"' % file) + + import startfile + if self.server.options.debug: + print >>sys.stderr, '%s: SERVER: opening "%s"'%(sys.argv[0], + file) + + status = startfile.open(file) + if status: + res = 'Opened: "%s"' % file + else: + res = 'Open failed: "%s"' % file + + return self.send_string(res, 'text/plain') + def send_report(self, report): try: keys = self.load_report(report) @@ -456,6 +482,8 @@ File Bug if len(components)==2: if name=='report': return self.send_report(components[1]) + elif name=='open': + return self.send_open_report(components[1]) elif len(components)==1: if name=='quit': self.server.halt() @@ -464,8 +492,6 @@ File Bug return self.send_report_submit() elif name=='favicon.ico': return self.send_path(posixpath.join(kResources,'bugcatcher.ico')) - elif name=='scanview.css': - return self.send_path(posixpath.join(kResources,'scanview.css')) # Match directory entries. if components[-1] == '':