On 30/01/10 09:04, Ben Finney wrote:
As for getting access to ‘foolib’ for import: you need to make sure it's
on the import path somehow.
* For a library of general use, install it to the Python site packages.
You can then write your application as just one of an arbitrary number
of applications using that library from the Python public site
modules::
import foolib.wibble
import foolib.warble
Using distutils, I know how to install the packages into the appropriate
directory, so there is no issue with import *installed*
packages/modules. What I am talking about is the upstream tarball that,
when extracted into a directory, can run without being installed using
distutils. For example, I have a foo-1.2.3.tar.gz (created using
"setup.py sdist") that I extract to get (taking Guy's suggestion about
the package names)
foo-1.2.3.tar.gz
foo-1.2.3/
foo-1.2.3/bin/
foo-1.2.3/bin/foo
foo-1.2.3/foolib/
foo-1.2.3/foolib/__init__.py
...
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).
Forgive me if I haven't understood what you said or if my initial
question itself was unclear, I'm (clearly) not very experienced.
Also, say I take Guy's suggestion, then what is the advantage of keep my
executable in a bin/ directory when there is no conflict of file and
directory names?
Thank you,
Umang
--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org