svn commit: r562650 - in head/devel/ipython: . files

Ruslan Makhmatkhanov rm at FreeBSD.org
Tue Jan 26 10:33:14 UTC 2021


Author: rm
Date: Tue Jan 26 10:33:13 2021
New Revision: 562650
URL: https://svnweb.freebsd.org/changeset/ports/562650

Log:
  devel/ipython: actually unbreak autocompletion
  
  Remove broader patch added earlier - it still doesn't completely
  solve the problem.
  Instead add tiny patch to fix runtime with jedi 0.18 and add missing
  imports with second patch. Works just well with my tests.
  Both patches should be removed after next ipython release.
  
  PR:		252875
  Reported by:	rsmith at xs4all.nl
  Approved by:	python (with hat)

Added:
  head/devel/ipython/files/patch-IPython_core_completer.py   (contents, props changed)
  head/devel/ipython/files/patch-IPython_terminal_ptutils.py   (contents, props changed)
Deleted:
  head/devel/ipython/files/patch-autocompletion-fix
Modified:
  head/devel/ipython/Makefile

Modified: head/devel/ipython/Makefile
==============================================================================
--- head/devel/ipython/Makefile	Tue Jan 26 10:19:02 2021	(r562649)
+++ head/devel/ipython/Makefile	Tue Jan 26 10:33:13 2021	(r562650)
@@ -3,7 +3,7 @@
 
 PORTNAME=	ipython
 PORTVERSION=	7.19.0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	devel python
 MASTER_SITES=	CHEESESHOP
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}

Added: head/devel/ipython/files/patch-IPython_core_completer.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ipython/files/patch-IPython_core_completer.py	Tue Jan 26 10:33:13 2021	(r562650)
@@ -0,0 +1,41 @@
+--- IPython/core/completer.py.orig	2020-10-30 18:09:09 UTC
++++ IPython/core/completer.py
+@@ -988,8 +988,18 @@ def _make_signature(completion)-> str:
+ 
+     """
+ 
+-    return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for p in completion.params) if f])
++    # it looks like this might work on jedi 0.17
++    if hasattr(completion, 'get_signatures'):
++        signatures = completion.get_signatures()
++        if not signatures:
++            return  '(?)'
+ 
++        c0 = completion.get_signatures()[0]
++        return '('+c0.to_string().split('(', maxsplit=1)[1]
++
++    return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for signature in completion.get_signatures()
++                                          for p in signature.defined_names()) if f])
++
+ class IPCompleter(Completer):
+     """Extension of the completer class with IPython-specific features"""
+ 
+@@ -1370,8 +1380,7 @@ class IPCompleter(Completer):
+                 else:
+                     raise ValueError("Don't understand self.omit__names == {}".format(self.omit__names))
+ 
+-        interpreter = jedi.Interpreter(
+-            text[:offset], namespaces, column=cursor_column, line=cursor_line + 1)
++        interpreter = jedi.Interpreter(text[:offset], namespaces)
+         try_jedi = True
+ 
+         try:
+@@ -1398,7 +1407,7 @@ class IPCompleter(Completer):
+         if not try_jedi:
+             return []
+         try:
+-            return filter(completion_filter, interpreter.completions())
++            return filter(completion_filter, interpreter.complete(column=cursor_column, line=cursor_line + 1))
+         except Exception as e:
+             if self.debug:
+                 return [_FakeJediCompletion('Oops Jedi has crashed, please report a bug with the following:\n"""\n%s\ns"""' % (e))]

Added: head/devel/ipython/files/patch-IPython_terminal_ptutils.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ipython/files/patch-IPython_terminal_ptutils.py	Tue Jan 26 10:33:13 2021	(r562650)
@@ -0,0 +1,11 @@
+--- IPython/terminal/ptutils.py.orig	2020-10-30 18:09:09 UTC
++++ IPython/terminal/ptutils.py
+@@ -20,6 +20,8 @@ from prompt_toolkit.patch_stdout import patch_stdout
+ 
+ import pygments.lexers as pygments_lexers
+ import os
++import sys
++import traceback
+ 
+ _completion_sentinel = object()
+ 


More information about the svn-ports-all mailing list