Skip to contentSkip to conversation

Make all programs on kvm test use /usr/bin/python

PATCH In review Lucas Meneghel Rodrigues 4 participants 14 messages Jun 9, 2009 – Jun 15, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 Make all programs on kvm test use /usr/bin/python

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.

---
 client/tests/kvm/fix_cdkeys.py   |    2 +-
 client/tests/kvm/kvm_config.py   |    1 +
 client/tests/kvm/scan_results.py |    2 +-
 client/tests/kvm/stepeditor.py   |    2 +-
 client/tests/kvm/stepmaker.py    |    2 +-
 5 files changed, 5 insertions(+), 4 deletions(-)
client/tests/kvm/fix_cdkeys.py +1 -1
index 4f7a824..7f52c44 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
 import shutil, os, sys
 
 """
client/tests/kvm/kvm_config.py +1 -0
index 40f16f1..a3467a0 100755
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 import re, os, sys, StringIO
 from autotest_lib.client.common_lib import error
 
client/tests/kvm/scan_results.py +1 -1
index 156b7d4..a92c867 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
 """
 Program that parses the autotest results and return a nicely printed final test
 result.
client/tests/kvm/stepeditor.py +1 -1
index 9669200..6fb371b 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
 import pygtk, gtk, os, glob, shutil, sys, logging
 import ppm_utils
 pygtk.require('2.0')
client/tests/kvm/stepmaker.py +1 -1
index 2b7fd54..a9ddf25 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
 import pygtk, gtk, gobject, time, os, commands
 from autotest_lib.client.common_lib import error
 import kvm_utils, logging, ppm_utils, stepeditor
Signature · 1 line
1.6.2.2
#1 lore raw

PATCH 2/4 Make kvm_config.py to use internal/standard exeptions

Instead of resorting to internal autotest exception types, use either python standard exceptions or an internally defined ConfigError exception.

---
 client/tests/kvm/kvm_config.py |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
client/tests/kvm/kvm_config.py +9 -4
index a3467a0..cce931a 100755
@@ -8,6 +8,11 @@ KVM configuration file utility functions.
 @copyright: Red Hat 2008-2009
 """
 
+
+class ConfigError(Exception):
+    pass
+
+
 class config:
     """
     Parse an input file or string that follows the KVM Test Config File format
@@ -47,7 +52,7 @@ class config:
             @param filename: Path of the configuration file.
         """
         if not os.path.exists(filename):
-            raise Exception, "File %s not found" % filename
+            raise IOError("File %s not found" % filename)
         self.filename = filename
         file = open(filename, "r")
         self.list = self.parse(file, self.list)
@@ -357,7 +362,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 ConfigError(e_msg)
                 if self.debug and not restricted:
                     self.__debug_print(indented_line,
                                      "Entering variants block (%d dicts in"
@@ -402,7 +407,7 @@ class config:
                                             words[1])
                     if not os.path.exists(filename):
                         e_msg = "Cannot include %s -- file not found" % filename
-                        raise error.AutotestError(e_msg)
+                        raise ConfigError(e_msg)
                     new_file = open(filename, "r")
                     list = self.parse(new_file, list, restricted)
                     new_file.close()
@@ -410,7 +415,7 @@ class config:
                         self.__debug_print("", "Leaving file %s" % words[1])
                 else:
                     e_msg = "Cannot include anything because no file is open"
-                    raise error.AutotestError(e_msg)
+                    raise ConfigError(e_msg)
 
             # Parse multi-line exceptions
             # (the block is parsed for each dict separately)
Signature · 1 line
1.6.2.2
#2 lore raw

PATCH 3/4 Fix bad line breaks

During the conversion of the kvm_runtest_2 to the kvm test, some bad line breaks were introduced. Started using parenthesis implicit line continuation instead of backslash continuation in assignments that were using it.

---
 client/tests/kvm/kvm_guest_wizard.py |    8 ++++----
 client/tests/kvm/kvm_tests.py        |    4 ++--
 client/tests/kvm/kvm_utils.py        |   12 ++++++------
 client/tests/kvm/kvm_vm.py           |    4 ++--
 client/tests/kvm/make_html_report.py |    6 ++----
 5 files changed, 16 insertions(+), 18 deletions(-)
client/tests/kvm/kvm_guest_wizard.py +4 -4
index 01aeb97..2dd9be5 100644
@@ -105,8 +105,8 @@ def barrier_2(vm, words, fail_if_stuck_for, stuck_detection_history,
         time.sleep(sleep_duration)
 
     # Failure
-    message = "Barrier failed at step %s after %.2f seconds (%s)" % \
-            (current_step_num, time.time() - start_time, failure_message)
+    message = ("Barrier failed at step %s after %.2f seconds (%s)" %
+               (current_step_num, time.time() - start_time, failure_message))
 
     # What should we do with this failure?
     if words[-1] == "optional":
@@ -201,9 +201,9 @@ def run_steps(test, params, env):
                 logging.error("Variable not defined: %s" % words[1])
         elif words[0] == "barrier_2":
             if current_screendump:
-                scrdump_filename = \
+                scrdump_filename = (
                 os.path.join(ppm_utils.get_data_dir(steps_filename),
-                             current_screendump)
+                             current_screendump))
             else:
                 scrdump_filename = None
             if not barrier_2(vm, words, fail_if_stuck_for,
client/tests/kvm/kvm_tests.py +2 -2
index cccc48e..54d2a7a 100644
@@ -321,8 +321,8 @@ def run_autotest(test, params, env):
     status_fail = False
     if result_list == []:
         status_fail = True
-        message_fail = "Test '%s' did not produce any recognizable"
-        " results" % test_name
+        message_fail = ("Test '%s' did not produce any recognizable "
+                        "results" % test_name)
     for result in result_list:
         logging.info(str(result))
         if result[1] == "FAIL":
client/tests/kvm/kvm_utils.py +6 -6
index 434190d..0f4c770 100644
@@ -644,8 +644,8 @@ def scp_to_remote(host, port, username, password, local_path, remote_path,
 
     @return: True on success and False on failure.
     """
-    command = "scp -o UserKnownHostsFile=/dev/null -r -P %s %s %s@%s:%s" % \
-        (port, local_path, username, host, remote_path)
+    command = ("scp -o UserKnownHostsFile=/dev/null -r -P %s %s %s@%s:%s" %
+               (port, local_path, username, host, remote_path))
     return remote_scp(command, password, timeout)
 
 
@@ -664,8 +664,8 @@ def scp_from_remote(host, port, username, password, remote_path, local_path,
 
     @return: True on success and False on failure.
     """
-    command = "scp -o UserKnownHostsFile=/dev/null -r -P %s %s@%s:%s %s" % \
-        (port, username, host, remote_path, local_path)
+    command = ("scp -o UserKnownHostsFile=/dev/null -r -P %s %s@%s:%s %s" %
+               (port, username, host, remote_path, local_path))
     return remote_scp(command, password, timeout)
 
 
@@ -681,8 +681,8 @@ def ssh(host, port, username, password, prompt, timeout=10):
 
     @return: kvm_spawn object on success and None on failure.
     """
-    command = "ssh -o UserKnownHostsFile=/dev/null -p %s %s@%s" % \
-        (port, username, host)
+    command = ("ssh -o UserKnownHostsFile=/dev/null -p %s %s@%s" %
+               (port, username, host))
     return remote_login(command, password, prompt, "\n", timeout)
 
 
client/tests/kvm/kvm_vm.py +2 -2
index eb9717b..de21b2f 100644
@@ -118,8 +118,8 @@ class VM:
         # Find available monitor filename
         while True:
             # The monitor filename should be unique
-            self.instance = time.strftime("%Y%m%d-%H%M%S-") + \
-            kvm_utils.generate_random_string(4)
+            self.instance = (time.strftime("%Y%m%d-%H%M%S-") +
+                             kvm_utils.generate_random_string(4))
             self.monitor_file_name = os.path.join("/tmp",
                                                   "monitor-" + self.instance)
             if not os.path.exists(self.monitor_file_name):
client/tests/kvm/make_html_report.py +2 -4
index 6aed39e..7fb54e5 100755
@@ -1442,10 +1442,8 @@ return true;
     stat_str = 'No test cases executed'
     if total_executed>0:
         failed_perct = int(float(total_failed)/float(total_executed)*100)
-        stat_str = 'From %d tests executed, '
-        '%d have passed (%d%s)' % (total_executed, total_passed,failed_perct,
-                                   '% failures')
-
+        stat_str = ('From %d tests executed, %d have passed (%d%% failures)' %
+                    (total_executed, total_passed, failed_perct))
 
     kvm_ver_str = metadata['kvmver']
 
Signature · 1 line
1.6.2.2
#3 lore raw

PATCH 4/4 Fix bad logging calls

During the conversion of kvm autotest to upstream coding standards, some bad logging calls were left behind. This patch fixes them.

---
 client/tests/kvm/kvm_utils.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
client/tests/kvm/kvm_utils.py +3 -3
index 0f4c770..70a49c9 100644
@@ -304,7 +304,7 @@ class kvm_spawn:
 
         # Print some debugging info
         if match == None and self.poll() != 0:
-            logging.debug("Timeout elapsed or process terminated. Output:",
+            logging.debug("Timeout elapsed or process terminated. Output:%s",
                           format_str_for_message(data.strip()))
 
         return (match, data)
@@ -465,8 +465,8 @@ class kvm_spawn:
 
         # Print some debugging info
         if status != 0:
-            logging.debug("Command failed; status: %d, output:" % status \
-                    + format_str_for_message(output.strip()))
+            logging.debug("Command failed; status: %d, output:%s", status,
+                          format_str_for_message(output.strip()))
 
         return (status, output)
 
Signature · 1 line
1.6.2.2
#4 lore raw

Re: [KVM-AUTOTEST PATCH 3/4] Fix bad line breaks

In reply to Lucas Meneghel Rodrigues

Looks fine to me.

----- Original Message -----
From: "Lucas Meneghel Rodrigues" <[email protected]>
To: [email protected]
Cc: [email protected], "Lucas Meneghel Rodrigues" <[email protected]>
Sent: Tuesday, June 9, 2009 7:33:28 PM (GMT+0200) Auto-Detected
Subject: [KVM-AUTOTEST PATCH 3/4] Fix bad line breaks

During the conversion of the kvm_runtest_2 to the kvm test, some bad line breaks were introduced. Started using parenthesis implicit line continuation instead of backslash continuation in assignments that were using it.

---
 client/tests/kvm/kvm_guest_wizard.py |    8 ++++----
 client/tests/kvm/kvm_tests.py        |    4 ++--
 client/tests/kvm/kvm_utils.py        |   12 ++++++------
 client/tests/kvm/kvm_vm.py           |    4 ++--
 client/tests/kvm/make_html_report.py |    6 ++----
 5 files changed, 16 insertions(+), 18 deletions(-)
client/tests/kvm/kvm_guest_wizard.py +4 -4
index 01aeb97..2dd9be5 100644
@@ -105,8 +105,8 @@ def barrier_2(vm, words, fail_if_stuck_for, stuck_detection_history,
         time.sleep(sleep_duration)
 
     # Failure
-    message = "Barrier failed at step %s after %.2f seconds (%s)" % \
-            (current_step_num, time.time() - start_time, failure_message)
+    message = ("Barrier failed at step %s after %.2f seconds (%s)" %
+               (current_step_num, time.time() - start_time, failure_message))
 
     # What should we do with this failure?
     if words[-1] == "optional":
@@ -201,9 +201,9 @@ def run_steps(test, params, env):
                 logging.error("Variable not defined: %s" % words[1])
         elif words[0] == "barrier_2":
             if current_screendump:
-                scrdump_filename = \
+                scrdump_filename = (
                 os.path.join(ppm_utils.get_data_dir(steps_filename),
-                             current_screendump)
+                             current_screendump))
             else:
                 scrdump_filename = None
             if not barrier_2(vm, words, fail_if_stuck_for,
client/tests/kvm/kvm_tests.py +2 -2
index cccc48e..54d2a7a 100644
@@ -321,8 +321,8 @@ def run_autotest(test, params, env):
     status_fail = False
     if result_list == []:
         status_fail = True
-        message_fail = "Test '%s' did not produce any recognizable"
-        " results" % test_name
+        message_fail = ("Test '%s' did not produce any recognizable "
+                        "results" % test_name)
     for result in result_list:
         logging.info(str(result))
         if result[1] == "FAIL":
client/tests/kvm/kvm_utils.py +6 -6
index 434190d..0f4c770 100644
@@ -644,8 +644,8 @@ def scp_to_remote(host, port, username, password, local_path, remote_path,
 
     @return: True on success and False on failure.
     """
-    command = "scp -o UserKnownHostsFile=/dev/null -r -P %s %s %s@%s:%s" % \
-        (port, local_path, username, host, remote_path)
+    command = ("scp -o UserKnownHostsFile=/dev/null -r -P %s %s %s@%s:%s" %
+               (port, local_path, username, host, remote_path))
     return remote_scp(command, password, timeout)
 
 
@@ -664,8 +664,8 @@ def scp_from_remote(host, port, username, password, remote_path, local_path,
 
     @return: True on success and False on failure.
     """
-    command = "scp -o UserKnownHostsFile=/dev/null -r -P %s %s@%s:%s %s" % \
-        (port, username, host, remote_path, local_path)
+    command = ("scp -o UserKnownHostsFile=/dev/null -r -P %s %s@%s:%s %s" %
+               (port, username, host, remote_path, local_path))
     return remote_scp(command, password, timeout)
 
 
@@ -681,8 +681,8 @@ def ssh(host, port, username, password, prompt, timeout=10):
 
     @return: kvm_spawn object on success and None on failure.
     """
-    command = "ssh -o UserKnownHostsFile=/dev/null -p %s %s@%s" % \
-        (port, username, host)
+    command = ("ssh -o UserKnownHostsFile=/dev/null -p %s %s@%s" %
+               (port, username, host))
     return remote_login(command, password, prompt, "\n", timeout)
 
 
client/tests/kvm/kvm_vm.py +2 -2
index eb9717b..de21b2f 100644
@@ -118,8 +118,8 @@ class VM:
         # Find available monitor filename
         while True:
             # The monitor filename should be unique
-            self.instance = time.strftime("%Y%m%d-%H%M%S-") + \
-            kvm_utils.generate_random_string(4)
+            self.instance = (time.strftime("%Y%m%d-%H%M%S-") +
+                             kvm_utils.generate_random_string(4))
             self.monitor_file_name = os.path.join("/tmp",
                                                   "monitor-" + self.instance)
             if not os.path.exists(self.monitor_file_name):
client/tests/kvm/make_html_report.py +2 -4
index 6aed39e..7fb54e5 100755
@@ -1442,10 +1442,8 @@ return true;
     stat_str = 'No test cases executed'
     if total_executed>0:
         failed_perct = int(float(total_failed)/float(total_executed)*100)
-        stat_str = 'From %d tests executed, '
-        '%d have passed (%d%s)' % (total_executed, total_passed,failed_perct,
-                                   '% failures')
-
+        stat_str = ('From %d tests executed, %d have passed (%d%% failures)' %
+                    (total_executed, total_passed, failed_perct))
 
     kvm_ver_str = metadata['kvmver']
 
Signature · 6 lines
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

Re: [Autotest] [KVM-AUTOTEST PATCH 2/4] Make kvm_config.py to use internal/standard exeptions

In reply to Lucas Meneghel Rodrigues

Looks fine to me.

BTW, I think debug_print() should be prefixed by a single underscore, not two.
A double underscore should be used only when name mangling is required -- at least that's what I understood from PEP 8. Let me know what you think.

Thanks,
Michael

----- Original Message -----
From: "Lucas Meneghel Rodrigues" <[email protected]>
To: [email protected]
Cc: [email protected]
Sent: Tuesday, June 9, 2009 7:33:27 PM (GMT+0200) Auto-Detected
Subject: [Autotest] [KVM-AUTOTEST PATCH 2/4] Make kvm_config.py to use internal/standard exeptions

Instead of resorting to internal autotest exception types, use either python standard exceptions or an internally defined ConfigError exception.

---
 client/tests/kvm/kvm_config.py |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
client/tests/kvm/kvm_config.py +9 -4
index a3467a0..cce931a 100755
@@ -8,6 +8,11 @@ KVM configuration file utility functions.
 @copyright: Red Hat 2008-2009
 """
 
+
+class ConfigError(Exception):
+    pass
+
+
 class config:
     """
     Parse an input file or string that follows the KVM Test Config File format
@@ -47,7 +52,7 @@ class config:
             @param filename: Path of the configuration file.
         """
         if not os.path.exists(filename):
-            raise Exception, "File %s not found" % filename
+            raise IOError("File %s not found" % filename)
         self.filename = filename
         file = open(filename, "r")
         self.list = self.parse(file, self.list)
@@ -357,7 +362,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 ConfigError(e_msg)
                 if self.debug and not restricted:
                     self.__debug_print(indented_line,
                                      "Entering variants block (%d dicts in"
@@ -402,7 +407,7 @@ class config:
                                             words[1])
                     if not os.path.exists(filename):
                         e_msg = "Cannot include %s -- file not found" % filename
-                        raise error.AutotestError(e_msg)
+                        raise ConfigError(e_msg)
                     new_file = open(filename, "r")
                     list = self.parse(new_file, list, restricted)
                     new_file.close()
@@ -410,7 +415,7 @@ class config:
                         self.__debug_print("", "Leaving file %s" % words[1])
                 else:
                     e_msg = "Cannot include anything because no file is open"
-                    raise error.AutotestError(e_msg)
+                    raise ConfigError(e_msg)
 
             # Parse multi-line exceptions
             # (the block is parsed for each dict separately)
Signature · 6 lines
1.6.2.2

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
#6 lore raw

Re: [Autotest] [KVM-AUTOTEST PATCH 2/4] Make kvm_config.py to use internal/standard exeptions

One more thing: maybe we shouldn't test if the file exists and raise IOError ourselves -- python does this automatically anyway when we call open() for a file that doesn't exist.

----- Original Message -----
From: "Michael Goldish" <[email protected]>
To: "Lucas Meneghel Rodrigues" <[email protected]>
Cc: [email protected], [email protected]
Sent: Wednesday, June 10, 2009 3:21:20 PM (GMT+0200) Auto-Detected
Subject: Re: [Autotest] [KVM-AUTOTEST PATCH 2/4] Make kvm_config.py to use internal/standard exeptions

Looks fine to me.

BTW, I think debug_print() should be prefixed by a single underscore, not two.
A double underscore should be used only when name mangling is required -- at least that's what I understood from PEP 8. Let me know what you think.

Thanks,
Michael

----- Original Message -----
From: "Lucas Meneghel Rodrigues" <[email protected]>
To: [email protected]
Cc: [email protected]
Sent: Tuesday, June 9, 2009 7:33:27 PM (GMT+0200) Auto-Detected
Subject: [Autotest] [KVM-AUTOTEST PATCH 2/4] Make kvm_config.py to use internal/standard exeptions

Instead of resorting to internal autotest exception types, use either python standard exceptions or an internally defined ConfigError exception.

---
 client/tests/kvm/kvm_config.py |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
client/tests/kvm/kvm_config.py +9 -4
index a3467a0..cce931a 100755
@@ -8,6 +8,11 @@ KVM configuration file utility functions.
 @copyright: Red Hat 2008-2009
 """
 
+
+class ConfigError(Exception):
+    pass
+
+
 class config:
     """
     Parse an input file or string that follows the KVM Test Config File format
@@ -47,7 +52,7 @@ class config:
             @param filename: Path of the configuration file.
         """
         if not os.path.exists(filename):
-            raise Exception, "File %s not found" % filename
+            raise IOError("File %s not found" % filename)
         self.filename = filename
         file = open(filename, "r")
         self.list = self.parse(file, self.list)
@@ -357,7 +362,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 ConfigError(e_msg)
                 if self.debug and not restricted:
                     self.__debug_print(indented_line,
                                      "Entering variants block (%d dicts in"
@@ -402,7 +407,7 @@ class config:
                                             words[1])
                     if not os.path.exists(filename):
                         e_msg = "Cannot include %s -- file not found" % filename
-                        raise error.AutotestError(e_msg)
+                        raise ConfigError(e_msg)
                     new_file = open(filename, "r")
                     list = self.parse(new_file, list, restricted)
                     new_file.close()
@@ -410,7 +415,7 @@ class config:
                         self.__debug_print("", "Leaving file %s" % words[1])
                 else:
                     e_msg = "Cannot include anything because no file is open"
-                    raise error.AutotestError(e_msg)
+                    raise ConfigError(e_msg)
 
             # Parse multi-line exceptions
             # (the block is parsed for each dict separately)
Signature · 6 lines
1.6.2.2

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
#7 lore raw
In reply to Lucas Meneghel Rodrigues

I'd suggest you use the same mechanism as the other entry points, and override the python version where necessary - some distros have ancient or bleeding edge default Python versions.

see common.py -> setup_modules.py -> check_version.check_python_version

Quoted 70 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.

---
 client/tests/kvm/fix_cdkeys.py   |    2 +-
 client/tests/kvm/kvm_config.py   |    1 +
 client/tests/kvm/scan_results.py |    2 +-
 client/tests/kvm/stepeditor.py   |    2 +-
 client/tests/kvm/stepmaker.py    |    2 +-

 5 files changed, 5 insertions(+), 4 deletions(-)
client/tests/kvm/fix_cdkeys.py +1 -1
index 4f7a824..7f52c44 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python

 import shutil, os, sys

 """

client/tests/kvm/kvm_config.py +1 -0
index 40f16f1..a3467a0 100755
@@ -1,3 +1,4 @@
+#!/usr/bin/python

 import re, os, sys, StringIO
 from autotest_lib.client.common_lib import error

client/tests/kvm/scan_results.py +1 -1
index 156b7d4..a92c867 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python

 """
 Program that parses the autotest results and return a nicely printed final test result.

client/tests/kvm/stepeditor.py +1 -1
index 9669200..6fb371b 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python

 import pygtk, gtk, os, glob, shutil, sys, logging import ppm_utils
 pygtk.require('2.0')

client/tests/kvm/stepmaker.py +1 -1
index 2b7fd54..a9ddf25 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python

 import pygtk, gtk, gobject, time, os, commands
 from autotest_lib.client.common_lib import error
 import kvm_utils, logging, ppm_utils, stepeditor
--
1.6.2.2

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

#8 lore raw
Quoted 5 lines · Martin Bligh

I'd suggest you use the same mechanism as the other entry points, and override the python version where necessary - some distros have ancient or bleeding edge default Python versions.

see common.py -> setup_modules.py -> check_version.check_python_version

Done. Re-sent the patch of the stand alone programs. Thanks!

Quoted 75 lines · Lucas Meneghel Rodrigues
Quoted 65 lines

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.

---
 client/tests/kvm/fix_cdkeys.py   |    2 +-
 client/tests/kvm/kvm_config.py   |    1 +
 client/tests/kvm/scan_results.py |    2 +-
 client/tests/kvm/stepeditor.py   |    2 +-
 client/tests/kvm/stepmaker.py    |    2 +-
 5 files changed, 5 insertions(+), 4 deletions(-)
client/tests/kvm/fix_cdkeys.py +1 -1
index 4f7a824..7f52c44 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
 import shutil, os, sys
 
 """
client/tests/kvm/kvm_config.py +1 -0
index 40f16f1..a3467a0 100755
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 import re, os, sys, StringIO
 from autotest_lib.client.common_lib import error
 
client/tests/kvm/scan_results.py +1 -1
index 156b7d4..a92c867 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
 """
 Program that parses the autotest results and return a nicely printed final test
 result.
client/tests/kvm/stepeditor.py +1 -1
index 9669200..6fb371b 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
 import pygtk, gtk, os, glob, shutil, sys, logging
 import ppm_utils
 pygtk.require('2.0')
client/tests/kvm/stepmaker.py +1 -2
index 2b7fd54..a9ddf25 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
 import pygtk, gtk, gobject, time, os, commands
 from autotest_lib.client.common_lib import error
 import kvm_utils, logging, ppm_utils, stepeditor
--

1.6.2.2

Quoted 5 lines

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Lucas Meneghel Rodrigues
Software Engineer (QE)
Red Hat - Emerging Technologies
#9 lore raw

Even better would be to use "/usr/bin/python2".

This is because future distros will include python3, which is incompatible with python2 code.

"python" will be symlink of "python3".

-Alexey

#10 lore raw
Quoted 2 lines · Alexey Eromenko

Even better would be to use "/usr/bin/python2".

That doesn't seem to exist, on Ubuntu at least.

Quoted 6 lines

This is because future distros will include python3, which is incompatible with python2 code.

"python" will be symlink of "python3".

-Alexey

#11 lore raw
Quoted 7 lines · ----- "Martin Bligh
Quoted 2 lines · Alexey Eromenko

Even better would be to use "/usr/bin/python2".

That doesn't seem to exist, on Ubuntu at least.

Red Hat systems have it. "/usr/bin/python2" is a symlink to "/usr/bin/python" (which is python2 executable)

Is there any Ubuntu-compatible way of achieving this?

-Alexey

#12 lore raw
Quoted 7 lines · Alexey Eromenko
Quoted 5 lines · ----- "Martin Bligh
Quoted 2 lines · Alexey Eromenko

Even better would be to use "/usr/bin/python2".

Quoted 8 lines
Quoted 2 lines

That doesn't seem to exist, on Ubuntu at least.

Red Hat systems have it. "/usr/bin/python2" is a symlink to "/usr/bin/python" (which is python2 executable)

Is there any Ubuntu-compatible way of achieving this?

-Alexey

The patch I had already applied uses autotest code to figure the best python interpreter anyway, so it won't use python 3 if it's installed, it will prefer the 2.4 - 2.6 series...

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Lucas Meneghel Rodrigues
Software Engineer (QE)
Red Hat - Emerging Technologies
#13 lore raw
In reply to Alexey Eromenko
Quoted 6 lines · Alexey Eromenko
Quoted 3 lines · ----- "Martin Bligh
Quoted 1 line · Alexey Eromenko
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Even better would be to use "/usr/bin/python2".

That doesn't seem to exist, on Ubuntu at least.

Red Hat systems have it. "/usr/bin/python2" is a symlink to "/usr/bin/python" (which is python2 executable)

Is there any Ubuntu-compatible way of achieving this?

Not that I can see, other than explicit Python code, which we have already. I think this is a solved issue?