Review Request 121374: Cantor Python2 to Python3 backend porting for KF5

Pino Toscano pino at kde.org
Sun Dec 14 14:19:23 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121374/#review71978
-----------------------------------------------------------



src/backends/python/pythonbackend.cpp
<https://git.reviewboard.kde.org/r/121374/#comment50195>

    Move the python2 implementations of these into a new python2/python2backend.cpp, and add the respective python3 versions as python3/python3backend.cpp.



src/backends/python/pythonsession.cpp
<https://git.reviewboard.kde.org/r/121374/#comment50190>

    Please avoid unrelated style changes; just leave the blank lines as they were before (minimizes the diff and eases its reading).



src/backends/python/pythonutils.h
<https://git.reviewboard.kde.org/r/121374/#comment50191>

    Honestly: this feels to me a bit fragile, and it won't even catch all the occurrences (for example, the string "Spawning a new Python 2 session" will not be changed).
    
    A better approach would just change the actual debug strings with "python2" in them to have the python version as their prefix only.



src/backends/python2/CMakeLists.txt
<https://git.reviewboard.kde.org/r/121374/#comment50188>

    This seems unrelated to the actual "add python3 backend". Please send a different RR for it.



src/backends/python3/CMakeLists.txt
<https://git.reviewboard.kde.org/r/121374/#comment50192>

    Leave this out for now, and only if it's needed again it can be readded later.


Regarding the newly added python/pythonutils.h header: it would be better to make it just with declarations of helper functions, and do the actual implementations in python2/pythonutils.cpp and python3/pythonutils.cpp (to comple in each of them).

There you could add functions like:
* `dbgPrefix()` -> returning "python2" in the python2 backend, etc
* `PyObjectToQString()` -> convert a `PyObject*` containing a Unicode string to QString

All the code motion changes that touch python2 only stuff should be sent as separate RR.

- Pino Toscano


On Dic. 14, 2014, 1:38 p.m., Minh Ngo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/121374/
> -----------------------------------------------------------
> 
> (Updated Dic. 14, 2014, 1:38 p.m.)
> 
> 
> Review request for KDE Edu, Alexander Rieder and Filipe Saraiva.
> 
> 
> Repository: cantor
> 
> 
> Description
> -------
> 
> Have meda some fixes in cmake files to find python3 correctly...
> 
> 
> Diffs
> -----
> 
>   cmake/FindPythonLibs3.cmake PRE-CREATION 
>   src/backends/CMakeLists.txt e27c84d 
>   src/backends/R/cantor_r.knsrc 02f9a1e 
>   src/backends/kalgebra/cantor_kalgebra.knsrc d0103eb 
>   src/backends/lua/cantor_lua.knsrc 25165d0 
>   src/backends/maxima/cantor_maxima.knsrc 7cccce8 
>   src/backends/octave/cantor_octave.knsrc 735739a 
>   src/backends/python/pythonbackend.cpp 3f66f39 
>   src/backends/python/pythonexpression.cpp 883c3ea 
>   src/backends/python/pythonsession.cpp c252572 
>   src/backends/python/pythonutils.h PRE-CREATION 
>   src/backends/python2/CMakeLists.txt 260c2f0 
>   src/backends/python2/cantor_python2.knsrc 7ec699c 
>   src/backends/python3/CMakeLists.txt PRE-CREATION 
>   src/backends/python3/cantor_python3.knsrc PRE-CREATION 
>   src/backends/python3/python3backend.desktop PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/121374/diff/
> 
> 
> Testing
> -------
> 
> 1)
> a = 1
> b = 2
> print(a + b)
> 
> 2)
> import numpy as np
> a = np.array([1, 2, 3])
> print(a)
> 
> 
> Thanks,
> 
> Minh Ngo
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20141214/f85eed0c/attachment-0001.html>


More information about the kde-edu mailing list