[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Ideal directory structure?

Hi Umang,

On Sat, Jan 30, 2010 at 5:24 AM, Umang <umang.me@gmail.com> wrote:

Now in foo-1.2.3/bin/foo how do I import foolib.wibble so that an installed foo (i.e. /usr/bin/foo after a "setup.py install") can import from the installed module/package (somewhere inside /usr/lib/) while a foo extracted from a source tarball (foo-1.2.3/bin/foo) can import a module/package from the extracted package (foo-1.2.3/foolib/wibble.py).

The PyGTK project LottaNZB has the very same source tarball structure and the problem you describe has been solved as follows:

Add an executable script "run-foo.sh" to the root directory foo-1.2.3 with the following content:

FOOPATH=`dirname $0`

This allows you to run 'foo' locally using 'run-foo.sh' without having to modify sys.path in bin/foo. It's probably not the most elegant approach, but it worked well for me.


Reply to: