This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Python Application Packaging and releasing

Tags: None
(comma "," separated)
SyncMaster
Registered Member
Posts
121
Karma
0
OS
After this:

viewtopic.php?f=15&t=87138

I've made a simple X.509 certificate viewer that allows to view the basic details of a certificate in DER and PEM format.

So what I have now is a python script and the associated python for the ui.

My issues are now how do I package and release it to the general public.

Mainly what I want to know is:

- where do I put the scripts? I'm using /usr/local/bin right now
- How do I change the file associations for .der, .crt and .pem files?

Thanks!
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
First you will need to create a *.desktop file for your application.
A *.desktop file usually contains something like the following:

Code: Select all
[Desktop Entry]
Exec=<command to launch app> %U
Icon=<name of icon of the application, Eg: view-certificate>
Type=Application
Terminal=false
Categories=Qt;KDE;<Other categories app is in>
Name=<Name of application, Eg: KCertView>
Comment=<Comment on application, eg: X.509 Certificate viewer>
GenericName=<Generic name of application, eg: Certificate Viewer>
MimeType=<mimetypes app can handle, seperated by semi-colon>


You can find out the mimetype of the various supported X.509 files by running "file --mime-type" on them.

If your application requires arguments to launch, and isn't capable of selecting the certificate to open itself, you can remove the Categories line, and add "NoDisplay=true"

The command to run the application should usually not hard code a path also.

Example:
Code: Select all
[Desktop Entry]
Exec=kcertificate-viewer.py %U
Icon=view-certificate
Type=Application
Terminal=false
NoDisplay=true
Name=KCertView
Comment=X.509 Certificate viewer
GenericName=Certificate Viewer
MimeType=application/x-x509-ca-cert;application/pkix-cert


Once that is done, you will need to create a CMakeLists.txt file to install your application.

The following should get the job done, I have never written one for a Python app before though. Change the file names as needed.

Code: Select all
INSTALL( FILES kcertificate-viewer.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
INSTALL( FILES kcertificate-viewer.py DESTINATION ${INSTALL_TARGETS_DEFAULT_ARGS} )


If you have problems with that step, you may wish to ask on kde-buildsystem@kde.org


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
SyncMaster
Registered Member
Posts
121
Karma
0
OS
wow!

Thank you for your answer.

I will have a go on setting up as per your email.

Thanks!


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], markhm, rblackwell, sethaaaa, Sogou [Bot], Yahoo [Bot]