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

This closes #710
diff --git a/test/crossrunner/compat.py b/test/crossrunner/compat.py
new file mode 100644
index 0000000..70992f6
--- /dev/null
+++ b/test/crossrunner/compat.py
@@ -0,0 +1,21 @@
+import os
+import sys
+
+if sys.version_info[0] == 2:
+  _ENCODE = sys.getfilesystemencoding()
+
+  def path_join(*args):
+    bin_args = map(lambda a: a.decode(_ENCODE), args)
+    return os.path.join(*bin_args).encode(_ENCODE)
+
+  def str_join(s, l):
+    bin_args = map(lambda a: a.decode(_ENCODE), l)
+    b = s.decode(_ENCODE)
+    return b.join(bin_args).encode(_ENCODE)
+
+else:
+
+  path_join = os.path.join
+
+  def str_join(s, l):
+    return s.join(l)