Figure out how to have it working, and how to package it for release.
Targeting Qt 5.9.1.
Figure out how to have it working, and how to package it for release.
Targeting Qt 5.9.1.
Status | Assigned | Task | ||
---|---|---|---|---|
Open | rempt | T1625 Python Scripting | ||
Resolved | alvinhochun | T6503 Enable Python scripting for Windows builds | ||
Open | alvinhochun | T6540 Support using embedded Python package |
I managed to build Krita on Windows with sip and pyqt after a lot of changes (might push them on a temporary branch). I used a local install of python 3.6.1 but I'll need to use the one in 3rdparty at a later time...
The first thing Krita spits out is:
krita.scripting: Could not load C:/Python36/libs/libpython36.a
("F:\dev\krita\new\src\plugins\extensions\pykrita\plugin\utilities.cpp" line 176)
Trying to load the import lib is obviously not going to work. It's not a DLL.
It's from the PYTHON_LIBRARY var set by FindPythonLibrary.cmake which calls find_package(PythonLibs)
Also, isn't the plugin supposed to have already been linked to python36.dll? That's what the .a file supposed to do, right? I think that whole loading part can be removed.
Next up I have
~~~
[8484] krita.scripting: "Traceback (most recent call last):"
[8484] krita.scripting: " File \"F:/dev/krita/new/build_x64/install/share/krita/pykrita\\krita\\__init__.py\", line 8, in <module>"
[8484] krita.scripting: " from .api import *"
[8484] krita.scripting: " File \"F:/dev/krita/new/build_x64/install/share/krita/pykrita\\krita\\api.py\", line 28, in <module>"
[8484] krita.scripting: " from PyKrita.krita import *"
[8484] krita.scripting: "ModuleNotFoundError: No module named 'PyKrita.krita'"
[8484] krita.scripting: "Could not import krita"
~~~
which is a bit interesting, because if I check install\share\krita\pykrita there is a folder named PyKrita and inside it there is a krita.dll.
Is this DLL what the script tried to import? Or is it supposed to be another python script?
I think I'll need this setup...
Managed to eliminate the errors on the debug output. Tools->Scripts shows an empty list though...
PyKrita/krita.dll needs to be renamed as .pyd
Can anyone on Linux try cherry-picking commit R37:2722cbe1bfb9 and check whether python still works?
Looks like I've got the scripts to load. I'll start tidying up some patches for the simpler changes.
Still need to figure out how to deploy and package the python files and have it run on Windows nicely without needing user configuration.
As of d81740abfb333c9daf13254cd89deb57b34e320c, the build instructions for 3rdparty/ should be changed as below:
After that, build Krita as usual. Make sure SIP and PyQt are found during the configuration step.
TODO: Update the README
As of 6332f0dadacee404d6acd56abfd27bd9e65bc4b6, it can load the embedded Python if python3.dll *and* python36.dll are copied into bin/.