Using "setup.py" for an application, not a library module.

J

John Nagle

Most of the documentation for "setup.py" assumes you're packaging a
library module. (Ref: "http://docs.python.org/distutils/setupscript.html")
How do you properly package an application? What happens
on "setup.py install"? Where does the application get installed? Where does
the main program go?

If I package and build my app, it packages properly, and
unpacks and builds into

Messager1.0/build/lib

which is appropriate for a library, but not an application.
Here's the setup file.


distutils.core.setup(
name='Messager',
description="Baudot Teletype RSS and SMS program",
version='1.0',
author="John Nagle",
author_email="(e-mail address removed)",
packages=['messager'],
requires=['pyserial', 'feedparser']
)


John Nagle
 
P

Philip Semanchuk

Most of the documentation for "setup.py" assumes you're packaging a
library module. (Ref: "http://docs.python.org/distutils/setupscript.html
")
How do you properly package an application? What happens
on "setup.py install"? Where does the application get installed?
Where does
the main program go?

If I package and build my app, it packages properly, and
unpacks and builds into

Messager1.0/build/lib

which is appropriate for a library, but not an application.
Here's the setup file.


distutils.core.setup(
name='Messager',
description="Baudot Teletype RSS and SMS program",
version='1.0',
author="John Nagle",
author_email="(e-mail address removed)",
packages=['messager'],
requires=['pyserial', 'feedparser']
)

Hi John,
I'm not sure what part you find unpalatable other than "lib" being in
the pathname. I recently wrote a setup.py for an app called Analysis.
Under OS X, Linux and Windows it installs into the site-packages
directory so I can run it like so:

python C:\Python25\Lib\site-packages\analysis\main.py

or:

python /usr/local/lib/python2.6/dist-packages/analysis/main.py


Now, packaging an application according to the expectations of the
platform to provide a double-clickable icon will require something
like py2exe or py2app. distutils doesn't provide a facility for that.

DOes that give you an idea about what you were asking?

bye
Philip
 
A

Alan Franzoni

Most of the documentation for "setup.py" assumes you're packaging a
library module. (Ref: "http://docs.python.org/distutils/setupscript.html")
How do you properly package an application? What happens
on "setup.py install"? Where does the application get installed? Where
does
the main program go?

Usually, just package the lib and from your "main program" (e.g. the
script that goes in /usr/bin, for instance), do just something like that:

#!/usr/bin/python
from mylib import main
import sys

sys.exit(main())
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top