PDA

View Full Version : About Python



gheorghe_pop
August 20th, 2005, 03:21 PM
Yesterday i found a website with a tutorial about programming with galde and python. So I took it and was verry impressed. Now the problem is this:
I want to pack my aplication and distribute to other ussers. How can I do that? I saw many python apps that had a file called setup.py and to install the program you just had to run "python setup.py install". How can I do that? And more can i integrate the glade file and the python source in one executableo when I distribute my program Ihave to put the glade file also?
Thanks!

ow50
August 20th, 2005, 04:25 PM
I saw many python apps that had a file called setup.py and to install the program you just had to run "python setup.py install". How can I do that?Python module distutils (http://docs.python.org/lib/module-distutils.html)


And more can i integrate the glade file and the python source in one executableo when I distribute my program Ihave to put the glade file also?
Thanks!The Unixy way would be to put the python source code files under $PREFIX/lib/appname or $PREFIX/lib/python2.4/site-packages/appname, Glade files under $PREFIX/share/appname and an executable start script under $PREFIX/bin. Here $PREFIX could be for example /usr or /usr/local and appname the name of your application.

gheorghe_pop
August 20th, 2005, 11:46 PM
I was reading distutils but didn't understand anything. Cane some one give me a hint?
I have an app that has the following files:
bibi.py
bibi.glade
SimpleGladeApp.py
Can someone teach me how to write a setup.py for this app?
Thanks!

Retrix
August 21st, 2005, 02:13 AM
I used distutils for a usage meter for my ISP. It's available at http://users.on.net/~spohlenz/internode/. Have a go at dissecting that. It shouldn't be too complicated.

-Sam

ow50
August 21st, 2005, 03:15 AM
distutils has one big fault. It does not provide any uninstallation and there's no way to create debian packages. So, to be user-friendly you should generate a list of installed files at installation time and provide a script to remove those files.

gheorghe_pop
August 21st, 2005, 05:30 PM
I managed to write my first setup.py :)
but now i have a new problem. It's about SimpleGladeApp.py. If I want to run my application this file must be in the folder that bibi.py(my application is) is. How can i change that and where should i put this file.This file is generated by tepache[http://primates.ximian.com/~sandino/python-glade/]. And the referece to it is made in bibi.py I think here:


...
from SimpleGladeApp import SimpleGladeApp
from SimpleGladeApp import bindtextdomain

app_name = "bibi"
app_version = "0.0.1"
...

gheorghe_pop
August 21st, 2005, 10:15 PM
Yes!!!!
I've done it.I finaly figure it out. So tanks everyone for helping me out and here is my first working setup.py:

from distutils.core import setup
setup(name='bibi',
version='1.0',
description = 'Aici intra descrierea',
author = 'Pop Gheorghe',
author_email = 'pop.gheorghe@rdslink.ro',
url = 'http://adresa web',
license = 'GPL',
scripts=['bibi.py'],
py_modules =['SimpleGladeApp'],
data_files = [('share/bibi',['share/bibi/bibi.glade'])],
)

fng
August 23rd, 2005, 09:21 AM
Could you post the glade tutorial site?

EDIT:
Nevermind, i found it in another thread

http://primates.ximian.com/~sandino/python-glade/