summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorLuke Diamand <luke@diamand.org>2018-06-19 08:04:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-06-19 16:34:32 (GMT)
commitefdcc99263871818cfe297a5a981d5841c77ebac (patch)
tree4b2298b9ba004da6c1eda7dacb0cbc1f7b566652 /git-p4.py
parent4d88519f6a2c7ea170f239a638137ce26d39cb11 (diff)
downloadgit-efdcc99263871818cfe297a5a981d5841c77ebac.zip
git-efdcc99263871818cfe297a5a981d5841c77ebac.tar.gz
git-efdcc99263871818cfe297a5a981d5841c77ebac.tar.bz2
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>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/git-p4.py b/git-p4.py
index 67865d1..f127ebc 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -27,6 +27,22 @@ import zlib
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: