From 572198ed6c5d9582d0e406704e37d0f88365ec1f Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Mon, 20 Apr 2009 14:58:16 +1000 Subject: [PATCH] Include package & version info in report footers Signed-off-by: Jeremy Kerr --- hiprofile.py | 18 ++++++++++++++---- share/hiprofile/base.html | 4 ++++ share/hiprofile/style.css | 10 ++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/hiprofile.py b/hiprofile.py index c1d1052..6f99d3c 100644 --- a/hiprofile.py +++ b/hiprofile.py @@ -11,6 +11,12 @@ from jinja2 import Environment, FileSystemLoader b_id = 0 s_id = 0 +try: + __version__ = __import__('pkg_resources') \ + .get_distribution('hiprofile').version +except Exception: + __version__ = 'unknown' + def _get_count(node): """ Utility function: return the number in a 'count' element contained in the current node""" @@ -319,14 +325,18 @@ def write_report(report, resourcedir, outdir): shutil.copy(os.path.join(resourcedir, file), outdir) reportfile = os.path.join(outdir, 'index.html') - templates['report'].stream(report = report).dump(reportfile) + templates['report'].stream(version = __version__, + report = report).dump(reportfile) for binary in report.binaries: binaryfile = os.path.join(outdir, binary.filename()) - templates['binary'].stream(report = report, binary = binary). \ - dump(binaryfile) + templates['binary'].stream(version = __version__, + report = report, + binary = binary) \ + .dump(binaryfile) for symbol in binary.references: symbolfile = os.path.join(outdir, symbol.filename()) - templates['symbol'].stream(report = report, binary = binary, + templates['symbol'].stream(version = __version__, + report = report, binary = binary, symbol = symbol).dump(symbolfile) diff --git a/share/hiprofile/base.html b/share/hiprofile/base.html index 876c498..63f2cd1 100644 --- a/share/hiprofile/base.html +++ b/share/hiprofile/base.html @@ -13,6 +13,10 @@ {% block content %} {% endblock %} + diff --git a/share/hiprofile/style.css b/share/hiprofile/style.css index 37d1ffb..ff5aca5 100644 --- a/share/hiprofile/style.css +++ b/share/hiprofile/style.css @@ -75,3 +75,13 @@ td.source-expander { font-family: monospace; cursor: pointer; } + +div#footer { + color: #d0d0d0; + font-size: small; + text-align: center; +} +div#footer a { + color: inherit; + text-decoration: underline; +} -- 2.39.2