Jump to content
Sign in to follow this  
neddie

Python programs

Recommended Posts

Let's say I write a python program, and would like it to be packaged in Mandriva so that's available via urpmi. How would this be done? Would the rpm contain the .py file (the source code), or would it be compiled and distributed as a binary (presumably architecture-dependent) executable, presumably with a separate source package? I'm guessing that if the rpm contained the .py file, it would need to specify python as a dependency, but if it was an executable then presumably not.

 

Are there any "famous" programs which are already written in python, it's just not obvious that they're python?

Share this post


Link to post
Share on other sites

The exaile src rpm would be an excellent example to take a look at. Exaile also uses pygtk2.0 and pygtk2.0-libglade, you can see how that works in the exaile.spec file.

Share this post


Link to post
Share on other sites

So it looks like the exaile rpm contains lots of .py files (and .pyc and .pyo) - and one of its many dependencies is python. Would you say that's normal? That means, even if the python program is small, people will need to get python this and python that in order to use it?

 

I mean, obviously even for C++ programs you need the GUI libraries and other libraries in order to run it, but you don't need a C++ compiler. I was just curious what would be required to run a python program. I'm hoping that the requirements are reasonably small. And I'm sure the rpm dependencies would be handled pretty gracefully

 

Any idea how a python program could be distributed for cross-platform use? Would you just publish a tar.gz and let people unpack it and point the python interpreter at it? And the same tar.gz could be used on non-Linux platforms too? (Thinking of pyqt4 and matplotlib on either Win or Mac).

 

(By the way I'm certainly not yet at the stage where I'm preparing spec files for producing an rpm, I'm still at the prototyping stage...)

Share this post


Link to post
Share on other sites
So it looks like the exaile rpm contains lots of .py files (and .pyc and .pyo) - and one of its many dependencies is python. Would you say that's normal?
Most of the time that is true with complex apps.
That means, even if the python program is small, people will need to get python this and python that in order to use it?
Yes, so these depends need to be added as 'Requires:' in an rpm, or alternatively (but not officially Mandriva approved) be placed in the readme.txt, or built into the script that would install them.

 

Some python apps use a python or shell script to install the program from an extracted archive instead of an rpm.

python install.py

or

sh install.sh

Tunapie is a good example of this method to take a look at: tunapie.sourceforge.net

 

This tunapie program hasn't been touched since Sept. 2007, but it still works with Python 2.6.1 on Mandriva 2009.1.

Share this post


Link to post
Share on other sites

Tunapie is a most characteristic example. It's purely python, and it could work even if you put the scripts at a home folder.

For the record, it has been updated quite a few times recently, because some changes in wxgtk have made some of the scripts nonperforming.

Share this post


Link to post
Share on other sites
it has been updated quite a few times recently, because some changes in wxgtk have made some of the scripts nonperforming.

You're correct, I missed that in the changelog for 2.1.17 :oops:

Share this post


Link to post
Share on other sites

No probs. I know about the changes, because I had submitted a bug report for version 2.13 some months ago... :D

Apps like tunapie may look odd, because they are awful-looking (pretty much the norm for any wxgtk/wxpython app), but they are very small, very simple, very stable, and surprisingly functional.

Share this post


Link to post
Share on other sites
Most of the time that is true with complex apps.
So the source code is the program code, in that case - as opposed to for example C where only the compiled binary would be distributed and the source code would be in a separate package.

 

Fine for GPL, makes things much simpler for the packager, but I guess could be a problem if you wanted to distribute closed-source programs written in Python.

Of course, anything I release will be open source, if I get that far! :thumbs:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...