THRIFT-3439 Run make cross using Python3 when available
Client: Test
Patch: Nobuaki Sukegawa

This closes #710
diff --git a/test/crossrunner/test.py b/test/crossrunner/test.py
index 6a30b3e..63219e1 100644
--- a/test/crossrunner/test.py
+++ b/test/crossrunner/test.py
@@ -21,6 +21,7 @@
 import multiprocessing
 import os
 import sys
+from .compat import path_join
 
 from crossrunner.util import merge_dict
 
@@ -51,9 +52,7 @@
   def _fix_cmd_path(self, cmd):
     # if the arg is a file in the current directory, make it path
     def abs_if_exists(arg):
-      p = self.workdir.decode(sys.getfilesystemencoding())
-      p = os.path.join(p, arg.decode(sys.getfilesystemencoding()))
-      p = p.encode(sys.getfilesystemencoding())
+      p = path_join(self.workdir, arg)
       return p if os.path.exists(p) else arg
 
     if cmd[0] == 'python':
@@ -115,11 +114,7 @@
     if os.path.isabs(path):
       path = os.path.realpath(path)
     else:
-      tmp  = self.testdir.decode(sys.getfilesystemencoding())
-      path = path.decode(sys.getfilesystemencoding())
-      path = os.path.join(tmp, path)
-      path = path.encode(sys.getfilesystemencoding())
-      path = os.path.realpath(path)
+      path = os.path.realpath(path_join(self.testdir, path))
     config.update({key: path})
     return config