diff options
Diffstat (limited to 'src/jaegertracing/thrift/test/crossrunner/compat.py')
-rw-r--r-- | src/jaegertracing/thrift/test/crossrunner/compat.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/jaegertracing/thrift/test/crossrunner/compat.py b/src/jaegertracing/thrift/test/crossrunner/compat.py new file mode 100644 index 000000000..f1ca91bb3 --- /dev/null +++ b/src/jaegertracing/thrift/test/crossrunner/compat.py @@ -0,0 +1,24 @@ +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) + + logfile_open = open + +else: + + path_join = os.path.join + str_join = str.join + + def logfile_open(*args): + return open(*args, errors='replace') |