From efdcc99263871818cfe297a5a981d5841c77ebac Mon Sep 17 00:00:00 2001 From: Luke Diamand Date: Tue, 19 Jun 2018 09:04:09 +0100 Subject: git-p4: python3: basestring workaround In Python3, basestring no longer exists, so use this workaround. Signed-off-by: Luke Diamand Signed-off-by: Junio C Hamano --- git-p4.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'git-p4.py') 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: -- cgit v1.2.1