validate:launcher: Properly handle libsdir when gst-validate is installed

+ Fix the _in_devel function
+ Install the validate default testsuite implementation in the right
place
This commit is contained in:
Thibault Saunier 2014-08-11 20:19:02 +02:00
parent f6c62d071c
commit f4db183b2b
6 changed files with 21 additions and 10 deletions

View file

@ -281,6 +281,7 @@ po/Makefile.in
tools/Makefile
tools/launcher/Makefile
tools/launcher/apps/Makefile
tools/launcher/apps/validate/Makefile
])
AC_OUTPUT

View file

@ -24,7 +24,8 @@ LIBDIR = '@LIBDIR@'
def _in_devel():
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
root_dir = os.path.abspath(os.path.dirname(os.path.join(os.path.dirname(os.path.abspath(__file__)),
"..", "..", "..")))
return os.path.exists(os.path.join(root_dir, '.git'))
@ -32,9 +33,13 @@ def _add_gst_launcher_path():
if not _in_devel():
root = os.path.join(LIBDIR, 'gst-validate-launcher', 'python')
sys.path.insert(0, root)
else:
root = os.path.dirname(__file__)
return os.path.join(root, "launcher")
if "__main__" == __name__:
_add_gst_launcher_path()
libsdir = _add_gst_launcher_path()
from launcher.main import main
exit(main())
exit(main(libsdir))

View file

@ -1,6 +1,7 @@
appsdir = $(libdir)/gst-validate-launcher/python/launcher/apps/
SUBDIRS = validate
apps_PYTHON = \
ges-launch.py \
validate/validate_testsuite.py\
gst-validate.py

View file

@ -0,0 +1,3 @@
appsdir = $(libdir)/gst-validate-launcher/python/launcher/apps/validate
apps_PYTHON = validate_testsuite.py

View file

@ -763,10 +763,11 @@ class GstValidateTestsGenerator(TestsGenerator):
class _TestsLauncher(Loggable):
def __init__(self):
def __init__(self, libsdir):
Loggable.__init__(self)
self.libsdir = libsdir
self.options = None
self.testers = []
self.tests = []
@ -776,10 +777,10 @@ class _TestsLauncher(Loggable):
def _list_testers(self):
env = globals().copy()
d = os.path.dirname(__file__)
for f in os.listdir(os.path.join(d, "apps")):
appsdir = os.path.join(self.libsdir, "apps")
for f in os.listdir(appsdir):
if f.endswith(".py"):
execfile(os.path.join(d, "apps", f), env)
execfile(os.path.join(appsdir, f), env)
testers = [i() for i in utils.get_subclasses(TestsManager, env)]
for tester in testers:

View file

@ -180,7 +180,7 @@ class PrintUsage(argparse.Action):
print(HELP)
parser.exit()
def main():
def main(libsdir):
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, prog='gst-validate-launcher',
description=HELP)
parser.add_argument("-d", "--debug", dest="debug",
@ -301,7 +301,7 @@ user argument, you can thus overrides command line options using that.
loggable.init("GST_VALIDATE_LAUNCHER_DEBUG", True, False)
tests_launcher = _TestsLauncher()
tests_launcher = _TestsLauncher(libsdir)
tests_launcher.add_options(parser)
(options, args) = parser.parse_known_args()