git-p4: python3: basestring workaround
In Python3, basestring no longer exists, so use this workaround. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Luke Diamand committed
Jun 19, 2018 at 09:04 UTC
efdcc99263871818cfe297a5a981d5841c77ebac
1 file changed
+16
git-p4.py
+16
@@ -27,6 +27,22 @@ import zlib
27
import ctypes
28
import errno
29
30
+# support basestring in python3
31
+try:
32
+ unicode = unicode
33
+except NameError:
34
+ # 'unicode' is undefined, must be Python 3
35
+ str = str
36
+ unicode = str
37
+ bytes = bytes
38
+ basestring = (str,bytes)
39
+else:
40
+ # 'unicode' exists, must be Python 2
41
+ str = str
42
+ unicode = unicode
43
+ bytes = str
44
+ basestring = basestring
45
+
46
try:
47
from subprocess import CalledProcessError
48
except ImportError: