469,964 Members | 1,382 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

Re: Easy install / setuptools

En Thu, 29 May 2008 06:29:00 -0300, <Do*****************@ch.delarue.com>
I'm trying to figure out the "best" way to distribute my own python
packages. Basicly, what I want is to have something like an
"installer.exe" (on windows) which puts my package under
Python/Lib/site-packages (so that it can be found via the PYTHONPATH).

I've played around a bit with "easy install" and "setuptools" and the
.egg format. I've already managed to create a "myPackage.egg" file with
setup tools and "install" (it's just a copying) it ito the site-packages
directory using "easy install".
You don't need setuptools at all. Just write a setup.py file using the
standard distutils module, and execute:

python setup.py bdist_wininst

It will create an executable installer. A simple setup.py script looks
like this:

---begin setup.py---
from distutils.core import setup

setup(name='My Package',
description='This is the description of myPackage',
---end setup.py---

Read the "Distributing Python Modules" document in your Python
installation, or at <http://docs.python.org/dist/dist.html>
What I was wondering now is if there's a way to actually EXTRACT the egg
file and put the extracted file (i.e. the .py file) under site-packages.
And not the .egg?
Well... don't use an egg in the first place :)
The problem with egg files is that you can't use
"open(os.path.join(os.path.dirname(__file__),'myFi le')" and I'd need to
rewrite such code which I'd like to avoid if possible. Also, I don't
know whether leaving the python scripts packed inside the egg file is
slower for execution or not...
There are many other problems with egg files... (did I menction that I
hate eggs?)

Gabriel Genellina

Jun 27 '08 #1
1 1061
Gabriel Genellina wrote:
En Thu, 29 May 2008 06:29:00 -0300, <Do*****************@ch.delarue.com>
>I'm trying to figure out the "best" way to distribute my own python

Well... don't use an egg in the first place :)
"easy install" usually isn't. It tends to do the wrong thing,
then leave things in a confused state. Too many things have to
be set up right before "easy install" works easily.

"python setup.py" is the de-facto standard.

Yes, there's no really good, standard solution for Python

John Nagle
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.