git-p4: python3: basestring workaround
[gitweb.git] / git-p4.py
index 67865d14aa62896794827264c149232b8ab8b68b..f127ebce276947d879b2965eb94b79f68528b0e2 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
 import ctypes
 import errno
 
+# support basestring in python3
+try:
+    unicode = unicode
+except NameError:
+    # 'unicode' is undefined, must be Python 3
+    str = str
+    unicode = str
+    bytes = bytes
+    basestring = (str,bytes)
+else:
+    # 'unicode' exists, must be Python 2
+    str = str
+    unicode = unicode
+    bytes = str
+    basestring = basestring
+
 try:
     from subprocess import CalledProcessError
 except ImportError: