Skip to content

Instantly share code, notes, and snippets.

@marimeireles
Created January 24, 2020 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marimeireles/c012d72338dcda7043471ebb836273de to your computer and use it in GitHub Desktop.
Save marimeireles/c012d72338dcda7043471ebb836273de to your computer and use it in GitHub Desktop.
Some tips on how to deal with the Qt For Python ecosystem
So, hopefully one day I'll organize this in to an useful blog post for people interested in contributing to Qt For Python!
For now they're just messy notes:
**QtCreator**
if I need qtcreator stuff, remember to use this link = https://wiki.qt.io/Building_Qt_Creator_from_Git
to build qt-creator
I need to go to my qt-creator-build directory
and make qmake_all -j8
and then make -j8
and then ./bin/qtcreator to open it
**Debugging CPython code generated by Shiboken**
>build python by hand
>make
>make install
>the libraries are pointing to the system's libraries, so I have to modify the binaries to point to the right libs using a software called patchelf
>readelf -d bin/python3.6
>patchelf --set-rpath {pass the library} {binary that I want to use the lib}
>install virtualenv with the pip I installed with the python
> call the ./pip and install virtualenv
>create an environment inside my development
> pass the python version correctly and the place where you want to create using -p to pass the right python
>build pyside-setup
>go to the branch that you want to go
>export the CLANG variable
>open QtCreator from command line from the same place as you exported it
>find the pyside cmake file and open it inside qtCreator (~/development/pyside/pyside5.13   5.13  qtcreator)
>get inside the module inside the environment building, for example env/env_build/yourPythonVersion/
>everything that is named wrapper is resposible for generating the stuff that's used in pyside
---
>I must open the wrapper cpp from the class I want to debug from inside the build environment example(/home/mariana/development/pyside/pyside5.13/envQt5.133d_build/py3.7-qt5.13.1-64bit-debug/pyside2/PySide2/QtNetwork/PySide2/QtNetwork/qnetworkrequest_wrapper.cpp) remember to always be inside the environment when you do that because only inside the environment you have the pyside2 stuff installed.
>I must set up the debugging stop flag when the object is created in this code, usually called init (breaking point)
>projects
>run
>add
>custom executable
> add in executable the python that lies inside your build
> working directory is the directory of the file I want to debug
> command line arguments the name of the file I'm debugging
>debug
>debug menu
>choose where you want to debug, in this case I want to debug the cpython code that contains the implementation of the wrapper that I just opened and just added a stop point on for that I have to load the cmakelists in the (/home/mariana/development/pyside/pyside5.13/) directory and the exact location of the implementation will be given to me when I start running my project code. what happens is that my project code calls for a wrap implementation that in its turn call for a cpython implementation and the way this debug works is just analyzing the cpython stuff
>start debugging
>without deployment
----
shiboken has pyside-setup/sources/shiboken2/generator/shiboken2 a generator director where it saves all the codes that it uses to get your cpp libs and generate the cpython stuff
**Building Qt**
choosing which modules I wanna build
in the qt5 dir: ./init-repository --module-subset=QtCore,QtGui,QtWidgets
This will download the modules that I want
in the qt5-install dir: ../qt5/configure -developer-build -opensource -nomake examples -nomake tests
this will actually build the stuff
always use qt5-install dir to do everything. run tests, use the qt, everything
to build the new qt with cmake stuff:
./../../qt5/cmakeSource/cmake-3.15.3/bin/cmake -DFEATURE_developer_build=ON -DQT_USE_CCACHE=ON /home/mariana/development/qt6/qt5/qtbase/
I have t o create a new directory for every module. in this case this is the dir for qtbase
**Building Pyside2**
python setup.py install --qmake=/home/mariana/development/Qt/5.13.1/gcc_64/bin/qmake --build-tests --ignore-git --parallel=8 --module-subset=Core,Gui,Widgets,Network,Multimedia --reuse-build
I also have to be in the pyside-setup directory
path to build the docs:
~/development/pyside/pyside-setup/pyside3_build/py3.7-qt5.13.1-64bit-release/pyside2
remember to export the variable to use the correct qdoc: export PATH=/home/mariana/development/Qt/5.13.1/gcc_64/bin:$PATH
and use
make apidoc
**Making commits to Gerrit**
to add a new thing
this adds the template to my commit: gitdir=$(git rev-parse --git-dir); scp -p -P 29418 mariana@codereview.qt-project.org:hooks/commit-msg ${gitdir}/hooks/
I have to commit and then push to a branch that's something like: HEAD:refs/for/5.13
I have to git reset --hard HEAD^ 1 everytime I'm gonna stop working in something
>the git config file (~/Development/qt/pyside-setup/.git/config) must have the right remote. I have to setup the correct email for an specific remote, etc
to come back to my progress, I just have to fetch (or cherrypick) an specific commit
trimming files before adding to gerrit: in your same python environment, you can install flake8 (pip install flake8), and then run it on your files like flake8 --ignore=E501 *.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment