Skip to content
Snippets Groups Projects
Commit 660b9dee2788 authored by Marcin Kasperski's avatar Marcin Kasperski
Browse files

Yet another pycompat fix (whole matter of using it is to be considered…)

parent 7ff641bd9507
No related branches found
No related tags found
No related merge requests found
......@@ -65,9 +65,10 @@
# Tiny py2/py3 compatibility layer (used internally)
###########################################################################
# We mostly defer to Mercurial's own compatibility layer - if we are on py3,
# it exists (elsewhere no chances for working hg). But we add some fallbacks
# for older mercurials under py2.
# We mostly defer to Mercurial's own compatibility layer - if we are
# on py3, it exists (elsewhere no chances for working hg), if we are
# on py2 it may exist or not depending on Mercurial version. It it
# doesn't or is incomplete, we fix it.
def identity(a):
return a
......@@ -76,5 +77,13 @@
from mercurial import pycompat
# Podpórki dla funkcji deficytowych w starszych hg
pycompat.identity = identity
if not hasattr(pycompat, 'ispy3'):
pycompat.ispy3 = (sys.version_info[0] >= 3)
if not hasattr(pycompat, 'bytechr'):
pycompat.bytechr = chr
if not hasattr(pycompat, 'bytestr'):
pycompat.bytestr = str
if not hasattr(pycompat, 'maybebytestr'):
pycompat.maybebytestr = identity
......@@ -79,5 +88,17 @@
if not hasattr(pycompat, 'maybebytestr'):
pycompat.maybebytestr = identity
if not hasattr(pycompat, 'iterbytestr'):
pycompat.iterbytestr = iter
if not hasattr(pycompat, 'strkwargs'):
pycompat.strkwargs = identity
if not hasattr(pycompat, 'byteskwargs'):
pycompat.byteskwargs = identity
if not hasattr(pycompat, 'sysbytes'):
pycompat.sysbytes = identity
if not hasattr(pycompat, 'sysstr'):
pycompat.sysstr = identity
if not hasattr(pycompat, 'unicode'):
pycompat.unicode = unicode
except ImportError:
import imp
......
......@@ -15,7 +15,6 @@
py35: HGPYTHON3 = 1
py36: HGPYTHON3 = 1
py37: HGPYTHON3 = 1
basepython =
py26: python2.6
py27: python2.7
py35: python3.5
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment