[cfe-commits] r56409 - in /cfe/trunk/tools/scan-view: ScanView.py scan-view
Daniel Dunbar
daniel at zuster.org
Sun Sep 21 13:34:58 PDT 2008
Author: ddunbar
Date: Sun Sep 21 15:34:58 2008
New Revision: 56409
URL: http://llvm.org/viewvc/llvm-project?rev=56409&view=rev
Log:
scan-view tweaks:
- Update for scan-build table change.
- Add --auto-reload option (for development, avoids need to restart
server).
- Always send Last-Modified, with a reasonable value for dynamic content.
Modified:
cfe/trunk/tools/scan-view/ScanView.py
cfe/trunk/tools/scan-view/scan-view
Modified: cfe/trunk/tools/scan-view/ScanView.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/ScanView.py?rev=56409&r1=56408&r2=56409&view=diff
==============================================================================
--- cfe/trunk/tools/scan-view/ScanView.py (original)
+++ cfe/trunk/tools/scan-view/ScanView.py Sun Sep 21 15:34:58 2008
@@ -15,10 +15,15 @@
# Keys replaced by server.
+kReportColRE = re.compile('<!-- REPORTBUGCOL -->')
+kReportColRepl = '<td></td>'
kReportBugRE = re.compile('<!-- REPORTBUG id="report-(.*)\\.html" -->')
kReportBugRepl = '<td class="ReportBug"><a href="report/\\1">Report Bug</a></td>'
kBugKeyValueRE = re.compile('<!-- BUG([^ ]*) (.*) -->')
+kReportReplacements = [(kReportColRE, kReportColRepl),
+ (kReportBugRE, kReportBugRepl)]
+
###
__version__ = "0.1"
@@ -88,6 +93,12 @@
except OSError,e:
print 'OSError',e.errno
+ def finish_request(self, request, client_address):
+ if self.options.autoReload:
+ import ScanView
+ self.RequestHandlerClass = reload(ScanView).ScanViewRequestHandler
+ BaseHTTPServer.HTTPServer.finish_request(self, request, client_address)
+
def handle_error(self, request, client_address):
# Ignore socket errors
info = sys.exc_info()
@@ -95,7 +106,7 @@
if self.options.debug > 1:
print >>sys.stderr, "%s: SERVER: ignored socket error." % (sys.argv[0],)
return
- BaseHTTPServer.HTTPServer.handle_error(request, client_address)
+ BaseHTTPServer.HTTPServer.handle_error(self, request, client_address)
# Borrowed from Quixote, with simplifications.
def parse_query(qs, fields=None):
@@ -114,6 +125,7 @@
class ScanViewRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
server_version = "ScanViewServer/" + __version__
+ dynamic_mtime = time.time()
def do_HEAD(self):
try:
@@ -382,8 +394,9 @@
self.send_response(200)
self.send_header("Content-type", ctype)
self.send_header("Content-Length", str(len(s)))
- if mtime:
- self.send_header("Last-Modified", self.date_time_string(mtime))
+ if mtime is None:
+ mtime = self.dynamic_mtime
+ self.send_header("Last-Modified", self.date_time_string(mtime))
self.end_headers()
return StringIO.StringIO(s)
@@ -391,7 +404,8 @@
f = open(path,'r')
fs = os.fstat(f.fileno())
data = f.read()
- data = kReportBugRE.sub(kReportBugRepl, data)
+ for a,b in kReportReplacements:
+ data = a.sub(b, data)
return self.send_string(data, ctype, mtime=fs.st_mtime)
Modified: cfe/trunk/tools/scan-view/scan-view
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/scan-view?rev=56409&r1=56408&r2=56409&view=diff
==============================================================================
--- cfe/trunk/tools/scan-view/scan-view (original)
+++ cfe/trunk/tools/scan-view/scan-view Sun Sep 21 15:34:58 2008
@@ -76,6 +76,9 @@
parser.add_option("--debug", dest="debug", default=0,
action="count",
help="Print additional debugging information.")
+ parser.add_option("--auto-reload", dest="autoReload", default=False,
+ action="store_true",
+ help="Automatically update module for each request.")
parser.add_option("--no-browser", dest="startBrowser", default=True,
action="store_false",
help="Don't open a webbrowser on startup.")
More information about the cfe-commits
mailing list