1

I am writing a little python app. I want to be able to easily deploy the app. I know that python 2.6 will allow one to execute an egg directly if there is a main module at the egg's root. I actually have that working.

The one kink is that when I try to use the argparse library, I cannot include the library in the egg without installing it into my source directory (or symlinking in the argparse.py into my source dir) since the argparse module is in the top-level package.

If I install it into a subdirectory called "argparse", I have to import it like "from argparse import argparse" instead of the normal "import argparse".

I would like to be able to specify a site-packages type directory in the egg where I could just install the third party modules/packages. Is there any way to do this with setuptools (or some other egg builder)?

Thanks!

Wren T.
  • 596
  • 1
  • 5
  • 17

1 Answers1

0

I believe you can create a subdirectory called toplevel and in your entry point do

import sys
sys.path.insert(0, './toplevel')

Untested, though.

TryPyPy
  • 6,214
  • 5
  • 35
  • 63
  • 1
    I ended up doing something similar to this. I installed the used libs into an otherlibs package and included otherlibs in the packages list in the setup call. In the __main__ module, I then added each of the directories with a site.addsitedir() call. Now, I just need to find a good framework to perform the installations into subdirectories of otherlibs. Currently, I just use a shell script, but I want something more declarative to declare the lib dependencies. – Wren T. Jan 22 '11 at 19:54