summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Arteaga <andyspiros@gmail.com>2012-03-05 16:45:49 +0100
committerAndrea Arteaga <andyspiros@gmail.com>2012-03-05 16:45:49 +0100
commitd4f647843ee0b1a9cc5d8be2d6ec12dfb0dad3c3 (patch)
tree8f2190af0a2e30c08d4d14ea0f838ea6aa0172b4
parentMoved benchutils and portageutils to utils/. (diff)
downloadauto-numerical-bench-d4f647843ee0b1a9cc5d8be2d6ec12dfb0dad3c3.tar.gz
auto-numerical-bench-d4f647843ee0b1a9cc5d8be2d6ec12dfb0dad3c3.tar.bz2
auto-numerical-bench-d4f647843ee0b1a9cc5d8be2d6ec12dfb0dad3c3.zip
Renamed HTMLReport, made reports modular.
-rw-r--r--numbench/benchconfig.py6
-rw-r--r--numbench/benchpkgconfig.py70
-rw-r--r--numbench/report.py2
-rw-r--r--numbench/reports/html.py (renamed from numbench/htmlreport.py)2
4 files changed, 4 insertions, 76 deletions
diff --git a/numbench/benchconfig.py b/numbench/benchconfig.py
index a3b40cf..64b8982 100644
--- a/numbench/benchconfig.py
+++ b/numbench/benchconfig.py
@@ -39,11 +39,9 @@ if not locals().has_key('initialized'):
('ABI=$(portageq envvar ABI); echo `portageq envvar LIBDIR_$ABI`', \
stdout=sp.PIPE, shell=True).communicate()[0].strip()
if not libdir:
- libdir = '/usr/lib'
+ libdir = 'usr/lib'
else:
- libdir = '/usr/' + libdir
- while libdir[0] == '/':
- libdir = libdir[1:]
+ libdir = 'usr/' + libdir
# Parse arguments
passargs = sys.argv[3:]
diff --git a/numbench/benchpkgconfig.py b/numbench/benchpkgconfig.py
deleted file mode 100644
index 9051cb4..0000000
--- a/numbench/benchpkgconfig.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#=====================================================
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@gmail.com>
-#=====================================================
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-import os
-from os.path import join as pjoin, basename, dirname, exists
-import subprocess as sp
-
-import benchconfig as cfg
-
-def GetFile(file, impl, roots='/'):
- if file[-3:] != '.pc':
- fname = file + '.pc'
- else:
- fname = file
-
- libdir = cfg.libdir
- while libdir[0] == '/':
- libdir = libdir[1:]
-
- # Check alternatives
- if type(roots) == type(''):
- roots = roots,
- pkgcfgpath = ':'.join([pjoin(r,'etc/env.d/alternatives', file, impl, \
- libdir, 'pkgconfig', fname) for r in roots])
-
- if os.path.exists(pkgcfgpath):
- return pkgcfgpath
- else:
- raise Exception('pkg-config fname ' + file + ' not found', pkgcfgpath)
-
-def Requires(fname):
- env = {'PKG_CONFIG_PATH' : dirname(fname)}
- cmd = ['pkg-config', '--print-requires', basename(fname)[:-3]]
- proc = sp.Popen(cmd, env=env, stdout=sp.PIPE)
- return proc.communicate()[0].split()
-
-
-def Run(fname, root='/', requires=True):
- if not requires:
- lines = file(fname, 'r').readlines()
- newlines = [l for l in lines if l[:10] != 'Requires: ']
- file(fname, 'w').writelines(newlines)
-
- bname = basename(fname)
- if bname[-3:] == '.pc':
- bname = bname[:-3]
-
- env = {'PKG_CONFIG_PATH' : dirname(fname), 'PKG_CONFIG_SYSROOT_DIR' : root}
- cmd = ['pkg-config', '--libs', '--cflags', bname]
- proc = sp.Popen(cmd, env=env, stdout=sp.PIPE)
- out = proc.communicate()[0].strip()
-
- if not requires:
- file(fname, 'w').writelines(lines)
-
- return out \ No newline at end of file
diff --git a/numbench/report.py b/numbench/report.py
index 986e641..679aa54 100644
--- a/numbench/report.py
+++ b/numbench/report.py
@@ -21,7 +21,7 @@ from shutil import copy as fcopy, copytree, rmtree
import benchconfig as cfg
from utils import benchutils as bu
-from htmlreport import HTMLreport
+from reports.html import ReportFile as HTMLreport
from testdescr import testdescr
from benchprint import Print
diff --git a/numbench/htmlreport.py b/numbench/reports/html.py
index a0d61b4..356f2ab 100644
--- a/numbench/htmlreport.py
+++ b/numbench/reports/html.py
@@ -21,7 +21,7 @@ from xml.sax.saxutils import escape as xmlescape
import benchconfig as cfg
-class HTMLreport:
+class ReportFile:
def __init__(self, fname, title='Benchmarks report', \
inputfile=pjoin(cfg.reportdir, basename(cfg.inputfile))):
self.fname = fname