Search code examples
pythonqtubuntupyqtpackaging

pyqt gui application packaging for ubuntu


I am really new to packaging. I have developed a music player using pyqt in ubuntu. It has a gui and it uses sqlite database.

I have looked at distutil. What I understood is how to place modules and scripts in right place. What I don't understand is how to set paths for database, config files & log files. How do I achieve it the way other applications do it in ubuntu by maintainig all this data in '.application_name' folder under home for a user ?

Can anyone suggest a good example application to learn from or point in some direction?


Solution

  • You can use QDir.home() to get the absolute path to a user's home path. You can use this path when generating/accessing your database, config files and log files. For example, on first startup you can do something like:

    filePath = QDir.home() + "/.application_name"
    if not QDir.exists(filepath)
        QDir.mkdir(filepath)
    

    Then you can use filePath when reading/writing to the files from there on out.