Packaging a Python Program as a RPM

I thought that making an rpm would be difficult but I never imagined it being a nightmare. First let me set the scene: I have made a program with python, pyqt4 and pykde and a few of the standard python modules. No dependencies that aren’t on a standard KDE linux distro. The program is a graphical livestock and all round farm management suite. I want to make it an rpm so that it is super easy to install as I want to roll out to the 5 trial farms on an opensuse base. There is ample documentation but it is all so incredibly confusing and seems targeted at distributing modules. I’ve looked at IBM resources, openSUSE python packaging guidelines, fedora and so much more and it just doesn’t seem to be right for me or is too complicated. Youtube also yields nothing.

I really want to package the rpm properly so its easy for the farmers to install.

Let me describe the structure of my program:

/Farm Manager

  • modules.py (Multiple modules I have written and use in my program)
  • run.py (The scipt that runs my program)
  • /icons (A folder with all my icons in it)
  • setup.sh (A bash script which sets up the config files and directories in the user’s /home)

How would I go about packaging this as an rpm? I preferably don’t want to install my modules in the system python directory as I don’t feel comfortable putting the code where it could get in the way of other packages. Maybe going the /opt route would be best but I don’t know how to make an rpm + .spec for that.

I would really like to avoid a install.sh script which manually copies things to various directories as that is just not very professional or easy for the farmers to use.

There are some great articles and videos for packaging .debs and I was considering even using alien to make a rpm but that doesn’t always work and is to be avoided at almost all costs.

Thank you so much for any help you can give. I’ sure there must be a ton of people who would appreciate a nice guide to this.

Hi
It’s pretty straight forward by using a setup.py (I think there is easy_setup?). Have a look at wifiplotter setup.py as an example;
setup.py - wifiplotter - GUI program for linux to show the power spectrum of available access points - Google Project Hosting

The rpm is built here;
https://build.opensuse.org/package/files?package=wifiplotter&project=home%3Amalcolmlewis%3AMiscellanous

Thanks for your awesome and quick response. It still took me a while to figure it out but when I did get it right it became quite easy. The lack of a really nice basic walkthrough video with write-up is a pity because it would lower the barrier a lot for many people.

Maybe I’ll make one except I think would do a terrible job. Maybe after some practice I will. The python guide on packaging is in my opinion not fantastic because it isn’t targeted at newbies. Anyways thanks, dissecting packages and ypur setup.py helped.