Make all programs on kvm test use /usr/bin/python - take 2
PATCH 1/1 Make all programs on kvm test use /usr/bin/python - take 2
All kvm modules that can be used as stand alone programs were updated to use #!/usr/bin/python instead of #!/usr/bin/env python, complying with the rest of the autotest code base. As suggested by Martin, common.py was added. With this, the stand alone programs will be able to use the autotest library namespace and choose the best python interpreter available in the system.
--- client/tests/kvm/common.py | 8 ++++++++ client/tests/kvm/fix_cdkeys.py | 3 ++- client/tests/kvm/kvm_config.py | 4 +++- client/tests/kvm/make_html_report.py | 5 +++-- client/tests/kvm/stepeditor.py | 4 ++-- client/tests/kvm/stepmaker.py | 4 +++- 6 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 client/tests/kvm/common.py
client/tests/kvm/common.py new file +8 -0
@@ -0,0 +1,8 @@ +import os, sys +dirname = os.path.dirname(sys.modules[__name__].__file__) +client_dir = os.path.abspath(os.path.join(dirname, "..", "..")) +sys.path.insert(0, client_dir) +import setup_modules +sys.path.pop(0) +setup_modules.setup(base_path=client_dir, + root_module_name="autotest_lib.client")
client/tests/kvm/fix_cdkeys.py +2 -1
@@ -1,5 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/python import shutil, os, sys +import common """ Program that replaces the CD keys present on a KVM autotest configuration file.
client/tests/kvm/kvm_config.py +3 -1
@@ -1,4 +1,6 @@ +#!/usr/bin/python import re, os, sys, StringIO +import common from autotest_lib.client.common_lib import error """
@@ -356,7 +358,7 @@ class config: # (inside an exception or inside subvariants) if restricted: e_msg = "Using variants in this context is not allowed" - raise error.AutotestError() + raise error.AutotestError(e_msg) if self.debug and not restricted: self.__debug_print(indented_line, "Entering variants block (%d dicts in"
client/tests/kvm/make_html_report.py +3 -2
@@ -1,4 +1,7 @@ #!/usr/bin/python +import os, sys, re, getopt, time, datetime, commands +import common + """ Script used to parse the test results and generate an HTML report.
@@ -7,8 +10,6 @@ Script used to parse the test results and generate an HTML report. @author: Dror Russo ([email protected]) """ -import os, sys, re, getopt, time, datetime, commands - format_css=""" html,body {
client/tests/kvm/stepeditor.py +2 -2
@@ -1,6 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/python import pygtk, gtk, os, glob, shutil, sys, logging -import ppm_utils +import common, ppm_utils pygtk.require('2.0') """
client/tests/kvm/stepmaker.py +3 -1
@@ -1,8 +1,10 @@ -#!/usr/bin/env python +#!/usr/bin/python import pygtk, gtk, gobject, time, os, commands +import common from autotest_lib.client.common_lib import error import kvm_utils, logging, ppm_utils, stepeditor pygtk.require('2.0') + """ Step file creator/editor.
Signature · 1 line
1.6.2.2
Looks good.
Quoted 122 lines · Lucas Meneghel Rodrigues
All kvm modules that can be used as stand alone programs were updated to use #!/usr/bin/python instead of #!/usr/bin/env python, complying with the rest of the autotest code base. As suggested by Martin,
common.pywas added. With this, the stand alone programs will be able to use the autotest library namespace and choose the best python interpreter available in the system.Signed-off-by Lucas Meneghel Rodrigues <[email protected]>---
client/tests/kvm/common.py | 8 ++++++++client/tests/kvm/fix_cdkeys.py| 3 ++-client/tests/kvm/kvm_config.py| 4 +++-client/tests/kvm/make_html_report.py| 5 +++--client/tests/kvm/stepeditor.py| 4 ++--client/tests/kvm/stepmaker.py| 4 +++-6 files changed, 21 insertions(+), 7 deletions(-)create mode 100644
client/tests/kvm/common.pyclient/tests/kvm/common.py new file +8
-0@@ -0,0 +1,8 @@ +import os, sys +dirname = os.path.dirname(sys.modules[__name__].__file__) +client_dir = os.path.abspath(os.path.join(dirname, "..", "..")) +sys.path.insert(0, client_dir) +import setup_modules +sys.path.pop(0) +setup_modules.setup(base_path=client_dir, + root_module_name="autotest_lib.client")client/tests/kvm/fix_cdkeys.py +1
-1@@ -1,5 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/pythonimport shutil, os, sys
+import common"""
Program that replaces the CD keys present on a KVM autotest configuration file.client/tests/kvm/kvm_config.py +1
-0@@ -1,4 +1,6 @@ +#!/usr/bin/pythonimport re, os, sys, StringIO
+import common
from autotest_lib.client.common_lib import error"""
client/tests/kvm/kvm_config.py +0
-0@@ -356,7 +358,7 @@ class config: # (inside an exception or inside subvariants)if restricted:
e_msg= "Using variants in this context is not allowed"
- raiseerror.AutotestError()
+ raiseerror.AutotestError(e_msg)
if self.debug and not restricted:
self.__debug_print(indented_line,
"Entering variants block (%d dicts in"client/tests/kvm/make_html_report.py +3
-0@@ -1,4 +1,7 @@ #!/usr/bin/python +import os, sys, re, getopt, time, datetime, commands +import common +"""
Script used to parse the test results and generate an HTML report.client/tests/kvm/make_html_report.py +0
-0@@ -7,8 +10,6 @@ Script used to parse the test results and generate an HTML report. @author: Dror Russo ([email protected])"""
client/tests/kvm/make_html_report.py +0
-2-import os, sys, re, getopt, time, datetime, commands -format_css="""
html,body {client/tests/kvm/stepeditor.py +1
-1@@ -1,6 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/pythonimport pygtk, gtk, os, glob, shutil, sys, logging
client/tests/kvm/stepeditor.py +1
-1-import ppm_utils +import common, ppm_utilspygtk.require('2.0')
"""
client/tests/kvm/stepmaker.py +1
-1@@ -1,8 +1,10 @@ -#!/usr/bin/env python +#!/usr/bin/pythonimport pygtk, gtk, gobject, time, os, commands
+import common
from autotest_lib.client.common_lib import error
importkvm_utils, logging,ppm_utils, stepeditor
pygtk.require('2.0')
+
"""
Step file creator/editor.--
1.6.2.2_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest