[Piglit] [PATCH 08/20] framework: Fix unicode handling of command line arguments.

Jon Severinsson jon at severinsson.net
Wed Apr 17 09:14:47 PDT 2013


Unicode is supported by Python 2.7.3+, and required by 3.x.
---
 framework/exectest.py |   12 ++++++++++--
 1 fil ändrad, 10 tillägg(+), 2 borttagningar(-)

diff --git a/framework/exectest.py b/framework/exectest.py
index 93458ef..a226c15 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -50,8 +50,16 @@ class ExecTest(Test):
 		self.split_command = os.path.split(self.command[0])[1]
 		self.env = {}
 
-		if isinstance(self.command, basestring):
-			self.command = shlex.split(str(self.command))
+		if isinstance(self.command, str):
+			self.command = shlex.split(self.command)
+		try:
+			if isinstance(self.command, unicode):
+				if sys.hexversion >= 0x020703F0:
+					self.command = shlex.split(self.command)
+				else:
+					self.command = shlex.split(str(self.command))
+		except NameError:
+			pass
 
 		self.skip_test = self.check_for_skip_scenario(command)
 
-- 
1.7.10.4



More information about the Piglit mailing list