(+CC the debian bug)

Antonio Rojas:
> El lunes, 22 de mayo de 2017 18:56:00 (CEST) Ximin Luo escribió:
>> Has anyone had any success in making this work? In Debian we're suffering 
>> from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852780 at the moment.
>>
>> I'm not sure how Cantor is interfacing with Sage; and in Debian we do patch 
>> away a lot of CLI options relating to Sage-the-distro, similar to what 
>> Gentoo does.
>>
> 
> Hi,
>  I fixed the version detection in 16.12:
>  
> https://cgit.kde.org/cantor.git/commit/?id=8d3d07a683ca6758eada1cd8442047401c0fa83d
> 
>  However, interfacing with Sage is completely broken since the ipython 5.0 
> upgrade. Cantor uses KPtyProcess to read Sage's output, and the new ipython 
> highlighting confuses it (it can't interpret the ANSI codes). I guess the 
> easiest fix would be to add a flag to the sage command that would force 
> ipython to run in --simple-prompt mode, and make Cantor run sage with that 
> flag.
>  Also note that there is an ongoing Google SOC project about rewriting 
> Cantor's interface with its backends, so this may be fixed in the process.
> 

Thanks for the info. I had a play around, unfortunately --simple-prompt won't 
be sufficient.

1. I edited /usr/lib/python2.7/dist-packages/sage/repl/configuration.py to 
force _allow_ansi to always return False, which forces simple_prompt=True and 
term_title=False.

2. Then I binary-edited the regexp string in 
/usr/lib/x86_64-linux-gnu/qt5/plugins/cantor/backends/cantor_sagebackend.so to 
instead say '.[a-zA-Z\W].+\s+(\d+)\.(\d+)' - i.e. a hack that effectively 
removes the first parentheses so the broken code works "correctly" for 7.6.

Now cantor detects sage's version correctly, but then fails because of 
https://github.com/ipython/ipython/issues/9816

~~~~
found version:  ("[.. banner ANSI codes and box drawing characters ..] SageMath 
version 7.6", "7", "6")
using the current set of commands
out:  "[..]  SageMath version 7.6, Release Date: 2017-03-25  [..]\r\nIn [1]: In 
[2]: In [3]: In [4]: In [5]: In [6]: In [7]: In [8]: In [9]: ____TMP_DIR____ 
/home/infinity0/.sage/temp/pdeb1/30547\r\nIn [10]: In [11]: In [12]:   File 
\"<ipython-input-12-9233071d249d>\", line 1\r\n    def 
__cantor_enable_typesetting(enable):\r\n                                        
    ^\r\nSyntaxError: unexpected EOF while parsing\r\n\r\nIn [13]:   File 
\"<ipython-input-13-abf59f29300d>\", line 1\r\n    if(enable==true):\r\n        
             ^\r\nSyntaxError: unexpected EOF while parsing\r\n\r\nIn [14]: In 
[15]:   File \"<ipython-input-15-9a63718398be>\", line 1\r\n    else:\r\n       
^\r\nSyntaxError: invalid syntax\r\n\r\nIn [16]: In [17]: In [17]: 
____END_OF_INIT____\r\nIn [18]: "
~~~~

You get the same error when doing this manually with sage (with _allow_ansi 
hacked to be False as above):

~~~~
$ sage
[.. banner ..]
In [1]: def __cantor_enable_typesetting(enable):
  File "<ipython-input-1-9233071d249d>", line 1
    def __cantor_enable_typesetting(enable):
                                            ^
SyntaxError: unexpected EOF while parsing
~~~~

REPLs generally support multiline input (e.g. Python itself) so unless the GSoC 
student specifically wants Cantor+Sage to work, we'll have to try to figure out 
how to push ipython to fix their simple-prompt...

X

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git

Reply via email to