Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Sep 2021 15:58:29 GMT
From:      Po-Chuan Hsieh <sunpoet@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 49e503201871 - main - devel/py-debugpy: Add py-debugpy 1.4.3
Message-ID:  <202109271558.18RFwTV0030230@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=49e5032018715d2f3fdade9703ca3f5ab0865b7c

commit 49e5032018715d2f3fdade9703ca3f5ab0865b7c
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2021-09-27 15:28:08 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2021-09-27 15:55:49 +0000

    devel/py-debugpy: Add py-debugpy 1.4.3
    
    This debugger implements the Debug Adapter Protocol: debugProtocol.json [1].
    
    [1] https://github.com/microsoft/vscode-debugadapter-node/blob/main/debugProtocol.json
    
    WWW: https://github.com/microsoft/debugpy
---
 devel/Makefile                                     |   1 +
 devel/py-debugpy/Makefile                          |  22 +++
 devel/py-debugpy/distinfo                          |   3 +
 ...pydevd-_pydev_imps-_pydev_SimpleXMLRPCServer.py |  63 ++++++
 ...dored-pydevd-_pydev_imps-_pydev_SocketServer.py |  40 ++++
 ...-_vendored-pydevd-_pydev_imps-_pydev_inspect.py | 211 +++++++++++++++++++++
 ...ndored-pydevd-_pydev_imps-_pydev_pkgutil_old.py |  38 ++++
 ...vendored-pydevd-_pydev_imps-_pydev_xmlrpclib.py | 181 ++++++++++++++++++
 ...devd_bundle-pydevconsole_code_for_ironpython.py |  75 ++++++++
 ...-_vendored-pydevd-_pydevd_bundle-pydevd_exec.py |  11 ++
 ...dored-pydevd-pydevd_attach_to_process-_check.py |   7 +
 ...tach_to_process-winappdbg-plugins-do_example.py |  16 ++
 ...tach_to_process-winappdbg-plugins-do_exchain.py |  19 ++
 ..._to_process-winappdbg-plugins-do_exploitable.py |  16 ++
 devel/py-debugpy/pkg-descr                         |   5 +
 15 files changed, 708 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 8441479638df..1a8e2d0cf685 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -4400,6 +4400,7 @@
     SUBDIR += py-ddt
     SUBDIR += py-ddtrace
     SUBDIR += py-debtcollector
+    SUBDIR += py-debugpy
     SUBDIR += py-debugtools
     SUBDIR += py-decorator
     SUBDIR += py-decorator4
diff --git a/devel/py-debugpy/Makefile b/devel/py-debugpy/Makefile
new file mode 100644
index 000000000000..e010939dda1e
--- /dev/null
+++ b/devel/py-debugpy/Makefile
@@ -0,0 +1,22 @@
+# Created by: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
+
+PORTNAME=	debugpy
+PORTVERSION=	1.4.3
+CATEGORIES=	devel python
+MASTER_SITES=	CHEESESHOP
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	sunpoet@FreeBSD.org
+COMMENT=	Implementation of the Debug Adapter Protocol for Python
+
+LICENSE=	EPL MIT
+LICENSE_COMB=	dual
+LICENSE_FILE_MIT=	${WRKSRC}/LICENSE
+
+USES=		dos2unix python:3.6+ zip
+USE_PYTHON=	autoplist concurrent cython distutils
+
+post-install:
+	${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR} -name '*.so' -exec ${STRIP_CMD} {} +
+
+.include <bsd.port.mk>
diff --git a/devel/py-debugpy/distinfo b/devel/py-debugpy/distinfo
new file mode 100644
index 000000000000..1d84c85620a4
--- /dev/null
+++ b/devel/py-debugpy/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1632664286
+SHA256 (debugpy-1.4.3.zip) = 4d53fe5aecf03ba466aa7fa7474c2b2fe28b2a6c0d36688d1e29382bfe88dd5f
+SIZE (debugpy-1.4.3.zip) = 4149685
diff --git a/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_SimpleXMLRPCServer.py b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_SimpleXMLRPCServer.py
new file mode 100644
index 000000000000..9ff1943d667f
--- /dev/null
+++ b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_SimpleXMLRPCServer.py
@@ -0,0 +1,63 @@
+--- src/debugpy/_vendored/pydevd/_pydev_imps/_pydev_SimpleXMLRPCServer.py.orig	2021-09-26 20:11:30 UTC
++++ src/debugpy/_vendored/pydevd/_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
+ 
diff --git a/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_SocketServer.py b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_SocketServer.py
new file mode 100644
index 000000000000..55b356d5f5ea
--- /dev/null
+++ b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_SocketServer.py
@@ -0,0 +1,40 @@
+--- src/debugpy/_vendored/pydevd/_pydev_imps/_pydev_SocketServer.py.orig	2021-09-09 10:13:20 UTC
++++ src/debugpy/_vendored/pydevd/_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))
+ 
+@@ -703,10 +703,7 @@ class DatagramRequestHandler(BaseRequestHandler):
+     """Define self.rfile and self.wfile for datagram sockets."""
+ 
+     def setup(self):
+-        try:
+-            from cStringIO 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()
diff --git a/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_inspect.py b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_inspect.py
new file mode 100644
index 000000000000..f7dc737269c0
--- /dev/null
+++ b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_inspect.py
@@ -0,0 +1,211 @@
+--- src/debugpy/_vendored/pydevd/_pydev_imps/_pydev_inspect.py.orig	2021-09-26 20:08:06 UTC
++++ src/debugpy/_vendored/pydevd/_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
diff --git a/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_pkgutil_old.py b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_pkgutil_old.py
new file mode 100644
index 000000000000..a95f1c6ea248
--- /dev/null
+++ b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_pkgutil_old.py
@@ -0,0 +1,38 @@
+--- src/debugpy/_vendored/pydevd/_pydev_imps/_pydev_pkgutil_old.py.orig	2021-09-26 20:08:06 UTC
++++ src/debugpy/_vendored/pydevd/_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:
diff --git a/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_xmlrpclib.py b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_xmlrpclib.py
new file mode 100644
index 000000000000..e923b44a4e37
--- /dev/null
+++ b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydev_imps-_pydev_xmlrpclib.py
@@ -0,0 +1,181 @@
+--- src/debugpy/_vendored/pydevd/_pydev_imps/_pydev_xmlrpclib.py.orig	2021-09-26 20:08:06 UTC
++++ src/debugpy/_vendored/pydevd/_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, "<", "&lt;")
+     return replace(s, ">", "&gt;",)
+ 
+-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
+@@ -319,7 +319,7 @@ else:
+         def __int__(self):
+             return self.value
+ 
+-        def __nonzero__(self):
++        def __bool__(self):
+             return self.value
+ 
+     True, False = Boolean(1), Boolean(0)
+@@ -420,9 +420,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 +448,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 +682,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 +692,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 +706,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 +1230,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 +1253,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 +1278,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 +1355,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 +1410,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"
+ 
diff --git a/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydevd_bundle-pydevconsole_code_for_ironpython.py b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydevd_bundle-pydevconsole_code_for_ironpython.py
new file mode 100644
index 000000000000..32bdefe9ce2f
--- /dev/null
+++ b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydevd_bundle-pydevconsole_code_for_ironpython.py
@@ -0,0 +1,75 @@
+--- src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevconsole_code_for_ironpython.py.orig	2021-09-26 20:08:05 UTC
++++ src/debugpy/_vendored/pydevd/_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, *args, **kwargs):
+         """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):
diff --git a/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydevd_bundle-pydevd_exec.py b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydevd_bundle-pydevd_exec.py
new file mode 100644
index 000000000000..dff8307276da
--- /dev/null
+++ b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydevd_bundle-pydevd_exec.py
@@ -0,0 +1,11 @@
+--- src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_exec.py.orig	2021-09-26 20:08:05 UTC
++++ src/debugpy/_vendored/pydevd/_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)
diff --git a/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-_check.py b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-_check.py
new file mode 100644
index 000000000000..0c14352ae3d1
--- /dev/null
+++ b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-_check.py
@@ -0,0 +1,7 @@
+--- src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_check.py.orig	2021-09-09 10:13:20 UTC
++++ src/debugpy/_vendored/pydevd/pydevd_attach_to_process/_check.py
+@@ -1,2 +1,2 @@
+ import add_code_to_python_process
+-print add_code_to_python_process.run_python_code(3736, "print(20)", connect_debugger_tracing=False)
+\ No newline at end of file
++print(add_code_to_python_process.run_python_code(3736, "print(20)", connect_debugger_tracing=False))
diff --git a/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-winappdbg-plugins-do_example.py b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-winappdbg-plugins-do_example.py
new file mode 100644
index 000000000000..231418caedee
--- /dev/null
+++ b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-winappdbg-plugins-do_example.py
@@ -0,0 +1,16 @@
+--- src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/plugins/do_example.py.orig	2021-09-09 10:13:22 UTC
++++ src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/plugins/do_example.py
+@@ -34,8 +34,8 @@ __revision__ = "$Id$"
+ 
+ def do(self, arg):
+     ".example - This is an example plugin for the command line debugger"
+-    print "This is an example command."
+-    print "%s.do(%r, %r):" % (__name__, self, arg)
+-    print "  last event", self.lastEvent
+-    print "  prefix", self.cmdprefix
+-    print "  arguments", self.split_tokens(arg)
++    print("This is an example command.")
++    print("%s.do(%r, %r):" % (__name__, self, arg))
++    print("  last event", self.lastEvent)
++    print("  prefix", self.cmdprefix)
++    print("  arguments", self.split_tokens(arg))
diff --git a/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-winappdbg-plugins-do_exchain.py b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-winappdbg-plugins-do_exchain.py
new file mode 100644
index 000000000000..4519a2140a3b
--- /dev/null
+++ b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-winappdbg-plugins-do_exchain.py
@@ -0,0 +1,19 @@
+--- src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/plugins/do_exchain.py.orig	2021-09-26 20:11:29 UTC
++++ src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/plugins/do_exchain.py
+@@ -37,8 +37,8 @@ from winappdbg import HexDump, Table
+ def do(self, arg):
+     ".exchain - Show the SEH chain"
+     thread = self.get_thread_from_prefix()
+-    print "Exception handlers for thread %d" % thread.get_tid()
+-    print
++    print("Exception handlers for thread %d" % thread.get_tid())
++    print()
+     table = Table()
+     table.addRow("Block", "Function")
+     bits = thread.get_bits()
+@@ -48,4 +48,4 @@ def do(self, arg):
+         if seh_func is not None:
+             seh_func = HexDump.address(seh_func, bits)
+         table.addRow(seh, seh_func)
+-    print table.getOutput()
++    print(table.getOutput())
diff --git a/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-winappdbg-plugins-do_exploitable.py b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-winappdbg-plugins-do_exploitable.py
new file mode 100644
index 000000000000..e9697d176bb6
--- /dev/null
+++ b/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-pydevd_attach_to_process-winappdbg-plugins-do_exploitable.py
@@ -0,0 +1,16 @@
+--- src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/plugins/do_exploitable.py.orig	2021-09-09 10:13:22 UTC
++++ src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/plugins/do_exploitable.py
+@@ -43,8 +43,8 @@ def do(self, arg):
+ 
+     status, rule, description = crash.isExploitable()
+ 
+-    print "-" * 79
+-    print "Exploitability: %s" % status
+-    print "Matched rule:   %s" % rule
+-    print "Description:    %s" % description
+-    print "-" * 79
++    print("-" * 79)
++    print("Exploitability: %s" % status)
++    print("Matched rule:   %s" % rule)
++    print("Description:    %s" % description)
++    print("-" * 79)
diff --git a/devel/py-debugpy/pkg-descr b/devel/py-debugpy/pkg-descr
new file mode 100644
index 000000000000..aa8192038d11
--- /dev/null
+++ b/devel/py-debugpy/pkg-descr
@@ -0,0 +1,5 @@
+This debugger implements the Debug Adapter Protocol: debugProtocol.json [1].
+
+[1] https://github.com/microsoft/vscode-debugadapter-node/blob/main/debugProtocol.json
+
+WWW: https://github.com/microsoft/debugpy



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109271558.18RFwTV0030230>