We actually forgot to fix this a long time ago, but it's
far more convenient to make scan_results.py to execute from
any diretory. Do this by figuring out the path for the script,
and then deducing the path to the results file by relative
positioning.

Special thanks to Alex Jia <a...@redhat.com> for sending
a preliminary fix for the problem.

Signed-off-by: Lucas Meneghel Rodrigues <l...@redhat.com>
---
 client/tools/scan_results.py |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/client/tools/scan_results.py b/client/tools/scan_results.py
index 71dddde..37efd35 100755
--- a/client/tools/scan_results.py
+++ b/client/tools/scan_results.py
@@ -90,9 +90,11 @@ def main(resfiles):
 
 
 if __name__ == "__main__":
-    import sys, glob
+    import sys, glob, os
+    dirname = os.path.dirname(sys.modules[__name__].__file__)
+    client_dir = os.path.abspath(os.path.join(dirname, ".."))
+    resfiles = glob.glob(os.path.join(client_dir, 'results', 'default', 
'status*'))
 
-    resfiles = glob.glob("../../results/default/status*")
     if len(sys.argv) > 1:
         if sys.argv[1] == "-h" or sys.argv[1] == "--help":
             print "Usage: %s [result files]" % sys.argv[0]
-- 
1.7.9.3

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to