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>
This commit is contained in:

committed by
Junio C Hamano

parent
4d88519f6a
commit
efdcc99263
16
git-p4.py
16
git-p4.py
@ -27,6 +27,22 @@ import zlib
|
|||||||
import ctypes
|
import ctypes
|
||||||
import errno
|
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:
|
try:
|
||||||
from subprocess import CalledProcessError
|
from subprocess import CalledProcessError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
Reference in New Issue
Block a user