From a6d6df1644ebf8a709c3165f3d1fe33ef0f2a2ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Mon, 30 Mar 2015 20:34:25 +0200 Subject: [PATCH] avocado.plugins.exec_path: Support for in-tree execution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In tree execution worked fine in virtual environment, but not without it. This commit tries to iterate through PATH and detect the in-tree libexec path. Signed-off-by: Lukáš Doktor --- avocado/plugins/exec_path.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/avocado/plugins/exec_path.py b/avocado/plugins/exec_path.py index 2416cc5c..6cdea801 100644 --- a/avocado/plugins/exec_path.py +++ b/avocado/plugins/exec_path.py @@ -58,7 +58,16 @@ class ExecPath(plugin.Plugin): elif os.path.exists('/usr/lib/avocado'): self.view.notify(event='minor', msg='/usr/lib/avocado') else: - self.view.notify(event='error', - msg="Can't locate avocado libexec path") - sys.exit(exit_codes.AVOCADO_FAIL) + for path in os.environ.get('PATH').split(':'): + if (os.path.exists(os.path.join(path, 'avocado')) and + os.path.exists(os.path.join(os.path.dirname(path), + 'libexec'))): + self.view.notify(event='minor', + msg=os.path.join(os.path.dirname(path), + 'libexec')) + break + else: + self.view.notify(event='error', + msg="Can't locate avocado libexec path") + sys.exit(exit_codes.AVOCADO_FAIL) return sys.exit(exit_codes.AVOCADO_ALL_OK) -- GitLab