From 7fba07485249cb94e2eee397e4833f1a839cefef Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Thu, 23 Aug 2012 21:45:10 +0200 Subject: [PATCH] Reflect changes in Bob db driver simplification --- xbob/db/replay/driver.py | 8 ++++---- xbob/db/replay/query.py | 2 +- xbob/db/replay/test.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xbob/db/replay/driver.py b/xbob/db/replay/driver.py index 9d6e9d6..d041f28 100644 --- a/xbob/db/replay/driver.py +++ b/xbob/db/replay/driver.py @@ -83,11 +83,11 @@ class Interface(BaseInterface): import pkg_resources # part of setuptools return pkg_resources.require('xbob.db.%s' % self.name())[0].version - def location(self): - return os.path.dirname(os.path.realpath(__file__)) - def files(self): - return ('db.sql3',) + + from pkg_resources import resource_filename + raw_files = ('db.sql3',) + return [resource_filename(__name__, k) for k in raw_files] def type(self): return 'sqlite' diff --git a/xbob/db/replay/query.py b/xbob/db/replay/query.py index ca7b122..3656d07 100644 --- a/xbob/db/replay/query.py +++ b/xbob/db/replay/query.py @@ -15,7 +15,7 @@ from .driver import Interface INFO = Interface() -SQLITE_FILE = os.path.join(INFO.location(), INFO.files()[0]) +SQLITE_FILE = INFO.files()[0] class Database(object): """The dataset class opens and maintains a connection opened to the Database. diff --git a/xbob/db/replay/test.py b/xbob/db/replay/test.py index 359e1b0..d6e77ce 100644 --- a/xbob/db/replay/test.py +++ b/xbob/db/replay/test.py @@ -105,11 +105,11 @@ class ReplayDatabaseTest(unittest.TestCase): for k,v in f.items(): self.assertTrue(v.find('enroll') != -1) - def test09_manage_location(self): + def test09_manage_files(self): from bob.db.script.dbmanage import main - self.assertEqual(main('replay location'.split()), 0) + self.assertEqual(main('replay files'.split()), 0) def test10_manage_dumplist_1(self): -- GitLab