aboutsummaryrefslogtreecommitdiffstats
path: root/git-p4.py
diff options
context:
space:
mode:
authorLuke Diamand <luke@diamand.org>2018-06-19 09:04:09 +0100
committerJunio C Hamano <gitster@pobox.com>2018-06-19 09:34:32 -0700
commitefdcc99263871818cfe297a5a981d5841c77ebac (patch)
tree4b2298b9ba004da6c1eda7dacb0cbc1f7b566652 /git-p4.py
parent4d88519f6a2c7ea170f239a638137ce26d39cb11 (diff)
downloadgit-efdcc99263871818cfe297a5a981d5841c77ebac.tar.gz
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 67865d14aa..f127ebce27 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: