Python application packaging for Linux

I created a GUI application using python and PyQt5. I want to pack this application, but there seems to be no direct way to do this. Moreover, I found answers to the question of how to package a python module, not an application. I have read various articles and white papers, but still don't have the right answer for this, although there are a few workarounds through which I could achieve the same, I just want to know what is the standard way.

This is my directory structure:

Moodly/
    Moodly/
        __init__.py
        controller.py
        logic.py
        models.py
        view.py
        resoure.py
        style.py

        sounds/
             notify.wav
             message.wav

    setup.py
    MANIFEST.in
    setup.cfg
    run.py
    moodly.png
    Moodly.desktop

What I want to achieve: The user receives the tar file from Moodly. The user retrieves it, runs the command

python setup.py install 

, Moodly.desktop, , usr/local/share/applications, .

:

setup.py

from setuptools import setup

setup(

name="Moodly",

version="1.0",

author="Akshay Agarwal",

author_email="agarwal.akshay.akshay8@gmail.com",

packages=["Moodly"],

include_package_data=True ,

url="http://github.com/AkshayAgarwal007/Moodly",

entry_points = {
          'gui_scripts': [
              'moodly = Moodly.controller:main',
          ],
      },

# license="LICENSE.txt",

description="Student Intimation system",

# long_description=open("README.txt").read(),

# Dependent packages (distributions)
)

MANIFEST.in

include Moodly/sounds/notify.wav
include Moodly/sounds/message.wav

setup.cfg :

python setup.py install

Moodly /usr/lib/python -3.4/site-packages . , ( setup.py), .

Moodly.desktop moodly.png usr/local/share/applications, :

setup.cfg

[install]
install_data=/usr/local/share/applications

setup.py

 data_files = [("Moodly", ["moodly.png","Moodly.desktop",])],

- python-3.4/site-packages/Moodly, , distutils

, ,

, :

python-packaging

distutils

, , . Moodly.desktop .

, Pyinstaller . Pyinstaller PyQt5, beautifulsoup4 ( , ), . install_requires, setuptools, , .

+4
1

.desktop Distutils. Distutils Python.

.desktop, , , , CMake.

CMake Python. , : https://bloerg.net/2012/11/10/cmake-and-distutils.html

, .desktop. , .desktop -, - :

install(PROGRAMS com.akshay.moodly.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})

CMakeLists.txt.

, .desktop ${XDG_APPS_INSTALL_DIR} ( CMake), hardcoded , /usr/local/share/applications - . ( ) , . , /usr/bin /usr/local/bin . /opt/Moodly $HOME/Moodly.

+2

Source: https://habr.com/ru/post/1621807/


All Articles