file=sys.stderr)
sys.exit(2)
- from os import fsencode
+ from os import fsdecode, fsencode
from shlex import quote
+ input = input
range = range
str_type = str
int_types = (int,)
def bytes_from_uint(i):
return bytes((i,))
+ def bytes_from_byte(b): # python > 2: b[3] returns ord('x'), not b'x'
+ return bytes((b,))
+
byte_int = lambda x: x
def buffer(object, offset=None, size=None):
"""Return the concatenated bytes or memoryview arguments as bytes."""
return b''.join(items)
+ def getcwd():
+ return fsencode(os.getcwd())
+
else: # Python 2
+ def fsdecode(x):
+ return x
+
def fsencode(x):
return x
from pipes import quote
- from os import environ
+ from os import environ, getcwd
from bup.py2raise import reraise
+ input = raw_input
range = xrange
str_type = basestring
int_types = (int, long)
def bytes_from_uint(i):
return chr(i)
+ def bytes_from_byte(b):
+ return b
+
byte_int = ord
buffer = buffer