diff options
author | Luke Diamand <luke@diamand.org> | 2018-06-19 09:04:09 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-06-19 09:34:32 -0700 |
commit | efdcc99263871818cfe297a5a981d5841c77ebac (patch) | |
tree | 4b2298b9ba004da6c1eda7dacb0cbc1f7b566652 | |
parent | git-p4: python3: remove backticks (diff) | |
download | tgif-efdcc99263871818cfe297a5a981d5841c77ebac.tar.xz |
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>
-rwxr-xr-x | git-p4.py | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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: |