git: b092e5cd1e91 - main - devel/py-pydevd: Fix build with setuptools 58.0.0+
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Mar 2022 13:50:08 UTC
The branch main has been updated by sunpoet:
URL: https://cgit.FreeBSD.org/ports/commit/?id=b092e5cd1e91e952d3d60a4c69fc06c903bbfead
commit b092e5cd1e91e952d3d60a4c69fc06c903bbfead
Author: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-03-25 13:32:21 +0000
Commit: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-03-25 13:38:11 +0000
devel/py-pydevd: Fix build with setuptools 58.0.0+
With hat: python
---
devel/py-pydevd/files/patch-2to3 | 827 +++++++++++++++++++++++++++++++++++++++
1 file changed, 827 insertions(+)
diff --git a/devel/py-pydevd/files/patch-2to3 b/devel/py-pydevd/files/patch-2to3
new file mode 100644
index 000000000000..9b14d28c4aa0
--- /dev/null
+++ b/devel/py-pydevd/files/patch-2to3
@@ -0,0 +1,827 @@
+--- _pydev_imps/_pydev_SimpleXMLRPCServer.py.orig 2017-03-14 15:21:50 UTC
++++ _pydev_imps/_pydev_SimpleXMLRPCServer.py
+@@ -155,7 +155,7 @@ def remove_duplicates(lst):
+ for x in lst:
+ u[x] = 1
+
+- return u.keys()
++ return list(u.keys())
+
+ class SimpleXMLRPCDispatcher:
+ """Mix-in class that dispatches XML-RPC requests.
+@@ -260,13 +260,13 @@ class SimpleXMLRPCDispatcher:
+ response = (response,)
+ response = xmlrpclib.dumps(response, methodresponse=1,
+ allow_none=self.allow_none, encoding=self.encoding)
+- except Fault, fault:
++ except Fault as fault:
+ response = xmlrpclib.dumps(fault, allow_none=self.allow_none,
+ encoding=self.encoding)
+ except:
+ # report exception back to server
+ response = xmlrpclib.dumps(
+- xmlrpclib.Fault(1, "%s:%s" % (sys.exc_type, sys.exc_value)), #@UndefinedVariable exc_value only available when we actually have an exception
++ xmlrpclib.Fault(1, "%s:%s" % (sys.exc_info()[0], sys.exc_info()[1])), #@UndefinedVariable exc_value only available when we actually have an exception
+ encoding=self.encoding, allow_none=self.allow_none,
+ )
+
+@@ -277,7 +277,7 @@ class SimpleXMLRPCDispatcher:
+
+ Returns a list of the methods supported by the server."""
+
+- methods = self.funcs.keys()
++ methods = list(self.funcs.keys())
+ if self.instance is not None:
+ # Instance can implement _listMethod to return a list of
+ # methods
+@@ -314,7 +314,7 @@ class SimpleXMLRPCDispatcher:
+ Returns a string containing documentation for the specified method."""
+
+ method = None
+- if self.funcs.has_key(method_name):
++ if method_name in self.funcs:
+ method = self.funcs[method_name]
+ elif self.instance is not None:
+ # Instance can implement _methodHelp to return help for a method
+@@ -363,7 +363,7 @@ class SimpleXMLRPCDispatcher:
+ # XXX A marshalling error in any response will fail the entire
+ # multicall. If someone cares they should fix this.
+ results.append([self._dispatch(method_name, params)])
+- except Fault, fault:
++ except Fault as fault:
+ results.append(
+ {'faultCode' : fault.faultCode,
+ 'faultString' : fault.faultString}
+@@ -371,7 +371,7 @@ class SimpleXMLRPCDispatcher:
+ except:
+ results.append(
+ {'faultCode' : 1,
+- 'faultString' : "%s:%s" % (sys.exc_type, sys.exc_value)} #@UndefinedVariable exc_value only available when we actually have an exception
++ 'faultString' : "%s:%s" % (sys.exc_info()[0], sys.exc_info()[1])} #@UndefinedVariable exc_value only available when we actually have an exception
+ )
+ return results
+
+--- _pydev_imps/_pydev_SocketServer.py.orig 2017-02-06 17:09:10 UTC
++++ _pydev_imps/_pydev_SocketServer.py
+@@ -336,12 +336,12 @@ class BaseServer:
+ The default is to print a traceback and continue.
+
+ """
+- print '-'*40
+- print 'Exception happened during processing of request from',
+- print client_address
++ print('-'*40)
++ print('Exception happened during processing of request from', end=' ')
++ print(client_address)
+ import traceback
+ traceback.print_exc() # XXX But this goes to stderr!
+- print '-'*40
++ print('-'*40)
+
+
+ class TCPServer(BaseServer):
+@@ -528,7 +528,7 @@ class ForkingMixIn:
+ if not pid: continue
+ try:
+ self.active_children.remove(pid)
+- except ValueError, e:
++ except ValueError as e:
+ raise ValueError('%s. x=%d and list=%r' % (e.message, pid,
+ self.active_children))
+
+@@ -704,9 +704,9 @@ class DatagramRequestHandler(BaseRequestHandler):
+
+ def setup(self):
+ try:
+- from cStringIO import StringIO
++ from io import StringIO
+ except ImportError:
+- from StringIO import StringIO
++ from io import StringIO
+ self.packet, self.socket = self.request
+ self.rfile = StringIO(self.packet)
+ self.wfile = StringIO()
+--- _pydev_imps/_pydev_inspect.py.orig 2016-04-26 16:50:14 UTC
++++ _pydev_imps/_pydev_inspect.py
+@@ -44,7 +44,7 @@ def isclass(object):
+ Class objects provide these attributes:
+ __doc__ documentation string
+ __module__ name of module in which this class was defined"""
+- return isinstance(object, types.ClassType) or hasattr(object, '__bases__')
++ return isinstance(object, type) or hasattr(object, '__bases__')
+
+ def ismethod(object):
+ """Return true if the object is an instance method.
+@@ -267,7 +267,7 @@ def getdoc(object):
+ doc = object.__doc__
+ except AttributeError:
+ return None
+- if not isinstance(doc, (str, unicode)):
++ if not isinstance(doc, str):
+ return None
+ try:
+ lines = string.split(string.expandtabs(doc), '\n')
+@@ -290,30 +290,29 @@ def getfile(object):
+ if ismodule(object):
+ if hasattr(object, '__file__'):
+ return object.__file__
+- raise TypeError, 'arg is a built-in module'
++ raise TypeError('arg is a built-in module')
+ if isclass(object):
+ object = sys.modules.get(object.__module__)
+ if hasattr(object, '__file__'):
+ return object.__file__
+- raise TypeError, 'arg is a built-in class'
++ raise TypeError('arg is a built-in class')
+ if ismethod(object):
+- object = object.im_func
++ object = object.__func__
+ if isfunction(object):
+- object = object.func_code
++ object = object.__code__
+ if istraceback(object):
+ object = object.tb_frame
+ if isframe(object):
+ object = object.f_code
+ if iscode(object):
+ return object.co_filename
+- raise TypeError, 'arg is not a module, class, method, ' \
+- 'function, traceback, frame, or code object'
++ raise TypeError('arg is not a module, class, method, ' \
++ 'function, traceback, frame, or code object')
+
+ def getmoduleinfo(path):
+ """Get the module name, suffix, mode, and module type for a given file."""
+ filename = os.path.basename(path)
+- suffixes = map(lambda (suffix, mode, mtype):
+- (-len(suffix), suffix, mode, mtype), imp.get_suffixes())
++ suffixes = [(-len(suffix_mode_mtype[0]), suffix_mode_mtype[0], suffix_mode_mtype[1], suffix_mode_mtype[2]) for suffix_mode_mtype in imp.get_suffixes()]
+ suffixes.sort() # try longest suffixes first, in case they overlap
+ for neglen, suffix, mode, mtype in suffixes:
+ if filename[neglen:] == suffix:
+@@ -356,12 +355,12 @@ def getmodule(object):
+ file = getabsfile(object)
+ except TypeError:
+ return None
+- if modulesbyfile.has_key(file):
++ if file in modulesbyfile:
+ return sys.modules[modulesbyfile[file]]
+- for module in sys.modules.values():
++ for module in list(sys.modules.values()):
+ if hasattr(module, '__file__'):
+ modulesbyfile[getabsfile(module)] = module.__name__
+- if modulesbyfile.has_key(file):
++ if file in modulesbyfile:
+ return sys.modules[modulesbyfile[file]]
+ main = sys.modules['__main__']
+ if hasattr(main, object.__name__):
+@@ -384,7 +383,7 @@ def findsource(object):
+ try:
+ file = open(getsourcefile(object))
+ except (TypeError, IOError):
+- raise IOError, 'could not get source code'
++ raise IOError('could not get source code')
+ lines = file.readlines()
+ file.close()
+
+@@ -396,26 +395,26 @@ def findsource(object):
+ pat = re.compile(r'^\s*class\s*' + name + r'\b')
+ for i in range(len(lines)):
+ if pat.match(lines[i]): return lines, i
+- else: raise IOError, 'could not find class definition'
++ else: raise IOError('could not find class definition')
+
+ if ismethod(object):
+- object = object.im_func
++ object = object.__func__
+ if isfunction(object):
+- object = object.func_code
++ object = object.__code__
+ if istraceback(object):
+ object = object.tb_frame
+ if isframe(object):
+ object = object.f_code
+ if iscode(object):
+ if not hasattr(object, 'co_firstlineno'):
+- raise IOError, 'could not find function definition'
++ raise IOError('could not find function definition')
+ lnum = object.co_firstlineno - 1
+ pat = re.compile(r'^(\s*def\s)|(.*\slambda(:|\s))')
+ while lnum > 0:
+ if pat.match(lines[lnum]): break
+ lnum = lnum - 1
+ return lines, lnum
+- raise IOError, 'could not find code object'
++ raise IOError('could not find code object')
+
+ def getcomments(object):
+ """Get lines of comments immediately preceding an object's source code."""
+@@ -479,7 +478,9 @@ class BlockFinder:
+ self.started = 0
+ self.last = 0
+
+- def tokeneater(self, type, token, (srow, scol), (erow, ecol), line):
++ def tokeneater(self, type, token, xxx_todo_changeme, xxx_todo_changeme1, line):
++ (srow, scol) = xxx_todo_changeme
++ (erow, ecol) = xxx_todo_changeme1
+ if not self.started:
+ if type == tokenize.NAME: self.started = 1
+ elif type == tokenize.NEWLINE:
+@@ -488,15 +489,15 @@ class BlockFinder:
+ self.indent = self.indent + 1
+ elif type == tokenize.DEDENT:
+ self.indent = self.indent - 1
+- if self.indent == 0: raise EndOfBlock, self.last
++ if self.indent == 0: raise EndOfBlock(self.last)
+ elif type == tokenize.NAME and scol == 0:
+- raise EndOfBlock, self.last
++ raise EndOfBlock(self.last)
+
+ def getblock(lines):
+ """Extract the block of code at the top of the given list of lines."""
+ try:
+ tokenize.tokenize(ListReader(lines).readline, BlockFinder().tokeneater)
+- except EndOfBlock, eob:
++ except EndOfBlock as eob:
+ return lines[:eob.args[0]]
+ # Fooling the indent/dedent logic implies a one-line definition
+ return lines[:1]
+@@ -530,7 +531,7 @@ def walktree(classes, children, parent):
+ classes.sort(lambda a, b: cmp(a.__name__, b.__name__))
+ for c in classes:
+ results.append((c, c.__bases__))
+- if children.has_key(c):
++ if c in children:
+ results.append(walktree(children[c], children, c))
+ return results
+
+@@ -548,13 +549,13 @@ def getclasstree(classes, unique=0):
+ for c in classes:
+ if c.__bases__:
+ for parent in c.__bases__:
+- if not children.has_key(parent):
++ if parent not in children:
+ children[parent] = []
+ children[parent].append(c)
+ if unique and parent in classes: break
+ elif c not in roots:
+ roots.append(c)
+- for parent in children.keys():
++ for parent in list(children.keys()):
+ if parent not in classes:
+ roots.append(parent)
+ return walktree(roots, children, None)
+@@ -569,7 +570,7 @@ def getargs(co):
+ Three things are returned: (args, varargs, varkw), where 'args' is
+ a list of argument names (possibly containing nested lists), and
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None."""
+- if not iscode(co): raise TypeError, 'arg is not a code object'
++ if not iscode(co): raise TypeError('arg is not a code object')
+
+ nargs = co.co_argcount
+ names = co.co_varnames
+@@ -622,10 +623,10 @@ def getargspec(func):
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None.
+ 'defaults' is an n-tuple of the default values of the last n arguments."""
+ if ismethod(func):
+- func = func.im_func
+- if not isfunction(func): raise TypeError, 'arg is not a Python function'
+- args, varargs, varkw = getargs(func.func_code)
+- return args, varargs, varkw, func.func_defaults
++ func = func.__func__
++ if not isfunction(func): raise TypeError('arg is not a Python function')
++ args, varargs, varkw = getargs(func.__code__)
++ return args, varargs, varkw, func.__defaults__
+
+ def getargvalues(frame):
+ """Get information about arguments passed into a particular frame.
+@@ -645,8 +646,8 @@ def joinseq(seq):
+
+ def strseq(object, convert, join=joinseq):
+ """Recursively walk a sequence, stringifying each element."""
+- if type(object) in [types.ListType, types.TupleType]:
+- return join(map(lambda o, c=convert, j=join: strseq(o, c, j), object))
++ if type(object) in [list, tuple]:
++ return join(list(map(lambda o, c=convert, j=join: strseq(o, c, j), object)))
+ else:
+ return convert(object)
+
+@@ -785,4 +786,4 @@ def stack(context=1):
+
+ def trace(context=1):
+ """Return a list of records for the stack below the current exception."""
+- return getinnerframes(sys.exc_traceback, context) #@UndefinedVariable
++ return getinnerframes(sys.exc_info()[2], context) #@UndefinedVariable
+--- _pydev_imps/_pydev_pkgutil_old.py.orig 2016-04-26 16:50:14 UTC
++++ _pydev_imps/_pydev_pkgutil_old.py
+@@ -140,7 +140,7 @@ def iter_modules(path=None, prefix=''):
+ if path is None:
+ importers = iter_importers()
+ else:
+- importers = map(get_importer, path)
++ importers = list(map(get_importer, path))
+
+ yielded = {}
+ for i in importers:
+@@ -329,7 +329,7 @@ try:
+ from zipimport import zipimporter
+
+ def iter_zipimport_modules(importer, prefix=''):
+- dirlist = zipimport._zip_directory_cache[importer.archive].keys()
++ dirlist = list(zipimport._zip_directory_cache[importer.archive].keys())
+ dirlist.sort()
+ _prefix = importer.prefix
+ plen = len(_prefix)
+@@ -526,7 +526,7 @@ def extend_path(path, name):
+ path = path[:] # Start with a copy of the existing path
+
+ for dir in sys.path:
+- if not isinstance(dir, basestring) or not os.path.isdir(dir):
++ if not isinstance(dir, str) or not os.path.isdir(dir):
+ continue
+ subdir = os.path.join(dir, pname)
+ # XXX This may still add duplicate entries to path on
+@@ -540,7 +540,7 @@ def extend_path(path, name):
+ if os.path.isfile(pkgfile):
+ try:
+ f = open(pkgfile)
+- except IOError, msg:
++ except IOError as msg:
+ sys.stderr.write("Can't open %s: %s\n" %
+ (pkgfile, msg))
+ else:
+--- _pydev_imps/_pydev_uuid_old.py.orig 2017-02-06 17:09:10 UTC
++++ _pydev_imps/_pydev_uuid_old.py
+@@ -132,7 +132,7 @@ class UUID(object):
+ hex = hex.strip('{}').replace('-', '')
+ if len(hex) != 32:
+ raise ValueError('badly formed hexadecimal UUID string')
+- int = long(hex, 16)
++ int = int(hex, 16)
+ if bytes_le is not None:
+ if len(bytes_le) != 16:
+ raise ValueError('bytes_le is not a 16-char string')
+@@ -142,39 +142,39 @@ class UUID(object):
+ if bytes is not None:
+ if len(bytes) != 16:
+ raise ValueError('bytes is not a 16-char string')
+- int = long(('%02x'*16) % tuple(map(ord, bytes)), 16)
++ int = int(('%02x'*16) % tuple(map(ord, bytes)), 16)
+ if fields is not None:
+ if len(fields) != 6:
+ raise ValueError('fields is not a 6-tuple')
+ (time_low, time_mid, time_hi_version,
+ clock_seq_hi_variant, clock_seq_low, node) = fields
+- if not 0 <= time_low < 1<<32L:
++ if not 0 <= time_low < 1<<32:
+ raise ValueError('field 1 out of range (need a 32-bit value)')
+- if not 0 <= time_mid < 1<<16L:
++ if not 0 <= time_mid < 1<<16:
+ raise ValueError('field 2 out of range (need a 16-bit value)')
+- if not 0 <= time_hi_version < 1<<16L:
++ if not 0 <= time_hi_version < 1<<16:
+ raise ValueError('field 3 out of range (need a 16-bit value)')
+- if not 0 <= clock_seq_hi_variant < 1<<8L:
++ if not 0 <= clock_seq_hi_variant < 1<<8:
+ raise ValueError('field 4 out of range (need an 8-bit value)')
+- if not 0 <= clock_seq_low < 1<<8L:
++ if not 0 <= clock_seq_low < 1<<8:
+ raise ValueError('field 5 out of range (need an 8-bit value)')
+- if not 0 <= node < 1<<48L:
++ if not 0 <= node < 1<<48:
+ raise ValueError('field 6 out of range (need a 48-bit value)')
+- clock_seq = (clock_seq_hi_variant << 8L) | clock_seq_low
+- int = ((time_low << 96L) | (time_mid << 80L) |
+- (time_hi_version << 64L) | (clock_seq << 48L) | node)
++ clock_seq = (clock_seq_hi_variant << 8) | clock_seq_low
++ int = ((time_low << 96) | (time_mid << 80) |
++ (time_hi_version << 64) | (clock_seq << 48) | node)
+ if int is not None:
+- if not 0 <= int < 1<<128L:
++ if not 0 <= int < 1<<128:
+ raise ValueError('int is out of range (need a 128-bit value)')
+ if version is not None:
+ if not 1 <= version <= 5:
+ raise ValueError('illegal version number')
+ # Set the variant to RFC 4122.
+- int &= ~(0xc000 << 48L)
+- int |= 0x8000 << 48L
++ int &= ~(0xc000 << 48)
++ int |= 0x8000 << 48
+ # Set the version number.
+- int &= ~(0xf000 << 64L)
+- int |= version << 76L
++ int &= ~(0xf000 << 64)
++ int |= version << 76
+ self.__dict__['int'] = int
+
+ def __cmp__(self, other):
+@@ -221,38 +221,38 @@ class UUID(object):
+ fields = property(get_fields)
+
+ def get_time_low(self):
+- return self.int >> 96L
++ return self.int >> 96
+
+ time_low = property(get_time_low)
+
+ def get_time_mid(self):
+- return (self.int >> 80L) & 0xffff
++ return (self.int >> 80) & 0xffff
+
+ time_mid = property(get_time_mid)
+
+ def get_time_hi_version(self):
+- return (self.int >> 64L) & 0xffff
++ return (self.int >> 64) & 0xffff
+
+ time_hi_version = property(get_time_hi_version)
+
+ def get_clock_seq_hi_variant(self):
+- return (self.int >> 56L) & 0xff
++ return (self.int >> 56) & 0xff
+
+ clock_seq_hi_variant = property(get_clock_seq_hi_variant)
+
+ def get_clock_seq_low(self):
+- return (self.int >> 48L) & 0xff
++ return (self.int >> 48) & 0xff
+
+ clock_seq_low = property(get_clock_seq_low)
+
+ def get_time(self):
+- return (((self.time_hi_version & 0x0fffL) << 48L) |
+- (self.time_mid << 32L) | self.time_low)
++ return (((self.time_hi_version & 0x0fff) << 48) |
++ (self.time_mid << 32) | self.time_low)
+
+ time = property(get_time)
+
+ def get_clock_seq(self):
+- return (((self.clock_seq_hi_variant & 0x3fL) << 8L) |
++ return (((self.clock_seq_hi_variant & 0x3f) << 8) |
+ self.clock_seq_low)
+
+ clock_seq = property(get_clock_seq)
+@@ -273,11 +273,11 @@ class UUID(object):
+ urn = property(get_urn)
+
+ def get_variant(self):
+- if not self.int & (0x8000 << 48L):
++ if not self.int & (0x8000 << 48):
+ return RESERVED_NCS
+- elif not self.int & (0x4000 << 48L):
++ elif not self.int & (0x4000 << 48):
+ return RFC_4122
+- elif not self.int & (0x2000 << 48L):
++ elif not self.int & (0x2000 << 48):
+ return RESERVED_MICROSOFT
+ else:
+ return RESERVED_FUTURE
+@@ -287,7 +287,7 @@ class UUID(object):
+ def get_version(self):
+ # The version bits are only meaningful for RFC 4122 UUIDs.
+ if self.variant == RFC_4122:
+- return int((self.int >> 76L) & 0xf)
++ return int((self.int >> 76) & 0xf)
+
+ version = property(get_version)
+
+@@ -383,9 +383,9 @@ def _netbios_getnode():
+ if win32wnet.Netbios(ncb) != 0:
+ continue
+ status._unpack()
+- bytes = map(ord, status.adapter_address)
+- return ((bytes[0]<<40L) + (bytes[1]<<32L) + (bytes[2]<<24L) +
+- (bytes[3]<<16L) + (bytes[4]<<8L) + bytes[5])
++ bytes = list(map(ord, status.adapter_address))
++ return ((bytes[0]<<40) + (bytes[1]<<32) + (bytes[2]<<24) +
++ (bytes[3]<<16) + (bytes[4]<<8) + bytes[5])
+
+ # Thanks to Thomas Heller for ctypes and for his help with its use here.
+
+@@ -437,7 +437,7 @@ def _windll_getnode():
+ def _random_getnode():
+ """Get a random node ID, with eighth bit set as suggested by RFC 4122."""
+ import random
+- return random.randrange(0, 1<<48L) | 0x010000000000L
++ return random.randrange(0, 1<<48) | 0x010000000000
+
+ _node = None
+
+@@ -487,18 +487,18 @@ def uuid1(node=None, clock_seq=None):
+ nanoseconds = int(time.time() * 1e9)
+ # 0x01b21dd213814000 is the number of 100-ns intervals between the
+ # UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
+- timestamp = int(nanoseconds/100) + 0x01b21dd213814000L
++ timestamp = int(nanoseconds/100) + 0x01b21dd213814000
+ if timestamp <= _last_timestamp:
+ timestamp = _last_timestamp + 1
+ _last_timestamp = timestamp
+ if clock_seq is None:
+ import random
+- clock_seq = random.randrange(1<<14L) # instead of stable storage
+- time_low = timestamp & 0xffffffffL
+- time_mid = (timestamp >> 32L) & 0xffffL
+- time_hi_version = (timestamp >> 48L) & 0x0fffL
+- clock_seq_low = clock_seq & 0xffL
+- clock_seq_hi_variant = (clock_seq >> 8L) & 0x3fL
++ clock_seq = random.randrange(1<<14) # instead of stable storage
++ time_low = timestamp & 0xffffffff
++ time_mid = (timestamp >> 32) & 0xffff
++ time_hi_version = (timestamp >> 48) & 0x0fff
++ clock_seq_low = clock_seq & 0xff
++ clock_seq_hi_variant = (clock_seq >> 8) & 0x3f
+ if node is None:
+ node = getnode()
+ return UUID(fields=(time_low, time_mid, time_hi_version,
+--- _pydev_imps/_pydev_xmlrpclib.py.orig 2016-04-26 16:50:14 UTC
++++ _pydev_imps/_pydev_xmlrpclib.py
+@@ -146,9 +146,9 @@ from types import *
+ # Internal stuff
+
+ try:
+- unicode
++ str
+ except NameError:
+- unicode = None # unicode support not available
++ str = None # unicode support not available
+
+ try:
+ import datetime
+@@ -162,8 +162,8 @@ except (NameError, AttributeError):
+
+ def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search):
+ # decode non-ascii string (if possible)
+- if unicode and encoding and is8bit(data):
+- data = unicode(data, encoding)
++ if str and encoding and is8bit(data):
++ data = str(data, encoding)
+ return data
+
+ def escape(s, replace=string.replace):
+@@ -171,7 +171,7 @@ def escape(s, replace=string.replace):
+ s = replace(s, "<", "<")
+ return replace(s, ">", ">",)
+
+-if unicode:
++if str:
+ def _stringify(string):
+ # convert to 7-bit ascii if possible
+ try:
+@@ -186,11 +186,11 @@ __version__ = "1.0.1"
+
+ # xmlrpc integer limits
+ try:
+- long
++ int
+ except NameError:
+ long = int
+-MAXINT = long(2) ** 31 - 1
+-MININT = long(-2) ** 31
++MAXINT = int(2) ** 31 - 1
++MININT = int(-2) ** 31
+
+ # --------------------------------------------------------------------
+ # Error constants (from Dan Libby's specification at
+@@ -291,7 +291,6 @@ class Fault(Error):
+ if _bool_is_builtin:
+ boolean = Boolean = bool #@UndefinedVariable
+ # to avoid breaking code which references xmlrpclib.{True,False}
+- True, False = True, False
+ else:
+ class Boolean:
+ """Boolean-value wrapper.
+@@ -319,11 +318,9 @@ else:
+ def __int__(self):
+ return self.value
+
+- def __nonzero__(self):
++ def __bool__(self):
+ return self.value
+
+- True, False = Boolean(1), Boolean(0)
+-
+ ##
+ # Map true or false value to XML-RPC boolean values.
+ #
+@@ -420,9 +417,9 @@ def _datetime_type(data):
+
+ import base64
+ try:
+- import cStringIO as StringIO
++ import io as StringIO
+ except ImportError:
+- import StringIO
++ import io
+
+ class Binary:
+ """Wrapper for binary data."""
+@@ -448,7 +445,7 @@ class Binary:
+
+ def encode(self, out):
+ out.write("<value><base64>\n")
+- base64.encode(StringIO.StringIO(self.data), out)
++ base64.encode(io.StringIO(self.data), out)
+ out.write("</base64></value>\n")
+
+ def _binary(data):
+@@ -682,7 +679,7 @@ class Marshaller:
+ write("</string></value>\n")
+ dispatch[StringType] = dump_string
+
+- if unicode:
++ if str:
+ def dump_unicode(self, value, write, escape=escape):
+ value = value.encode(self.encoding)
+ write("<value><string>")
+@@ -692,7 +689,7 @@ class Marshaller:
+
+ def dump_array(self, value, write):
+ i = id(value)
+- if self.memo.has_key(i):
++ if i in self.memo:
+ raise TypeError("cannot marshal recursive sequences")
+ self.memo[i] = None
+ dump = self.__dump
+@@ -706,15 +703,15 @@ class Marshaller:
+
+ def dump_struct(self, value, write, escape=escape):
+ i = id(value)
+- if self.memo.has_key(i):
++ if i in self.memo:
+ raise TypeError("cannot marshal recursive dictionaries")
+ self.memo[i] = None
+ dump = self.__dump
+ write("<value><struct>\n")
+- for k, v in value.items():
++ for k, v in list(value.items()):
+ write("<member>\n")
+ if type(k) is not StringType:
+- if unicode and type(k) is UnicodeType:
++ if str and type(k) is UnicodeType:
+ k = k.encode(self.encoding)
+ else:
+ raise TypeError("dictionary key must be string")
+@@ -1230,12 +1227,12 @@ class Transport:
+ if isinstance(host, TupleType):
+ host, x509 = host
+
+- import urllib
+- auth, host = urllib.splituser(host)
++ import urllib.request, urllib.parse, urllib.error
++ auth, host = urllib.parse.splituser(host)
+
+ if auth:
+ import base64
+- auth = base64.encodestring(urllib.unquote(auth))
++ auth = base64.encodestring(urllib.parse.unquote(auth))
+ auth = string.join(string.split(auth), "") # get rid of whitespace
+ extra_headers = [
+ ("Authorization", "Basic " + auth)
+@@ -1253,9 +1250,9 @@ class Transport:
+
+ def make_connection(self, host):
+ # create a HTTP connection object from a host descriptor
+- import httplib
++ import http.client
+ host, extra_headers, x509 = self.get_host_info(host)
+- return httplib.HTTP(host)
++ return http.client.HTTP(host)
+
+ ##
+ # Send request header.
+@@ -1278,7 +1275,7 @@ class Transport:
+ connection.putheader("Host", host)
+ if extra_headers:
+ if isinstance(extra_headers, DictType):
+- extra_headers = extra_headers.items()
++ extra_headers = list(extra_headers.items())
+ for key, value in extra_headers:
+ connection.putheader(key, value)
+
+@@ -1355,10 +1352,10 @@ class SafeTransport(Transport):
+ def make_connection(self, host):
+ # create a HTTPS connection object from a host descriptor
+ # host may be a string, or a (host, x509-dict) tuple
+- import httplib
++ import http.client
+ host, extra_headers, x509 = self.get_host_info(host)
+ try:
+- HTTPS = httplib.HTTPS
++ HTTPS = http.client.HTTPS
+ except AttributeError:
+ raise NotImplementedError(
+ "your version of httplib doesn't support HTTPS"
+@@ -1410,11 +1407,11 @@ class ServerProxy:
+ # establish a "logical" server connection
+
+ # get the url
+- import urllib
+- type, uri = urllib.splittype(uri)
++ import urllib.request, urllib.parse, urllib.error
++ type, uri = urllib.parse.splittype(uri)
+ if type not in ("http", "https"):
+ raise IOError("unsupported XML-RPC protocol")
+- self.__host, self.__handler = urllib.splithost(uri)
++ self.__host, self.__handler = urllib.parse.splithost(uri)
+ if not self.__handler:
+ self.__handler = "/RPC2"
+
+--- _pydevd_bundle/pydevconsole_code_for_ironpython.py.orig 2017-03-15 13:32:25 UTC
++++ _pydevd_bundle/pydevconsole_code_for_ironpython.py
+@@ -102,23 +102,23 @@ def _maybe_compile(compiler, source, filename, symbol)
+
+ try:
+ code = compiler(source, filename, symbol)
+- except SyntaxError, err:
++ except SyntaxError as err:
+ pass
+
+ try:
+ code1 = compiler(source + "\n", filename, symbol)
+- except SyntaxError, err1:
++ except SyntaxError as err1:
+ pass
+
+ try:
+ code2 = compiler(source + "\n\n", filename, symbol)
+- except SyntaxError, err2:
++ except SyntaxError as err2:
+ pass
+
+ if code:
+ return code
+ if not code1 and repr(err1) == repr(err2):
+- raise SyntaxError, err1
++ raise SyntaxError(err1)
+
+ def _compile(source, filename, symbol):
+ return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT)
+@@ -302,7 +302,7 @@ class InteractiveInterpreter:
+
+ """
+ try:
+- exec code in self.locals
++ exec(code, self.locals)
+ except SystemExit:
+ raise
+ except:
+@@ -338,7 +338,7 @@ class InteractiveInterpreter:
+ value = SyntaxError(msg, (filename, lineno, offset, line))
+ sys.last_value = value
+ list = traceback.format_exception_only(type, value)
+- map(self.write, list)
++ list(map(self.write, list))
+
+ def showtraceback(self):
+ """Display the exception that just occurred.
+@@ -361,7 +361,7 @@ class InteractiveInterpreter:
+ list[len(list):] = traceback.format_exception_only(type, value)
+ finally:
+ tblist = tb = None
+- map(self.write, list)
++ list(map(self.write, list))
+
+ def write(self, data):
+ """Write a string.
+@@ -436,7 +436,7 @@ class InteractiveConsole(InteractiveInterpreter):
+ line = self.raw_input(prompt)
+ # Can be None if sys.stdin was redefined
+ encoding = getattr(sys.stdin, "encoding", None)
+- if encoding and not isinstance(line, unicode):
++ if encoding and not isinstance(line, str):
+ line = line.decode(encoding)
+ except EOFError:
+ self.write("\n")
+@@ -480,7 +480,7 @@ class InteractiveConsole(InteractiveInterpreter):
+ implementation.
+
+ """
+- return raw_input(prompt)
++ return input(prompt)
+
+
+ def interact(banner=None, readfunc=None, local=None):
+--- _pydevd_bundle/pydevd_exec.py.orig 2017-02-06 17:09:10 UTC
++++ _pydevd_bundle/pydevd_exec.py
+@@ -1,5 +1,5 @@
+ def Exec(exp, global_vars, local_vars=None):
+ if local_vars is not None:
+- exec exp in global_vars, local_vars
++ exec(exp, global_vars, local_vars)
+ else:
+- exec exp in global_vars
+\ No newline at end of file
++ exec(exp, global_vars)
+--- pydev_ipython/inputhookglut.py.orig 2017-02-06 17:09:10 UTC
++++ pydev_ipython/inputhookglut.py
+@@ -95,7 +95,7 @@ def glut_close():
+ def glut_int_handler(signum, frame):
+ # Catch sigint and print the defautl message
+ signal.signal(signal.SIGINT, signal.default_int_handler)
+- print '\nKeyboardInterrupt'
++ print('\nKeyboardInterrupt')
+ # Need to reprint the prompt at this stage
+
+