Re: getting a python module accepted by python?
Sean 'Shaleh' Perry <shaleh@valinux.com> writes:
> Is there a way to make a site-packages/foo/foo.py without requiring a change
> in programs calling foo?
Only by the use of a .pth file -- if .../site-packages/foo.pth
contains "foo", then .../site-packages/foo will be added to the
default module search path. This mechanism is rarely used,
however... these days it's fairly uncommon for anything with more than
a small handful of Python source files to not be a package. Also,
this would just replace three files (soaplib.py{,c,o}) with five files
and a directory (soaplib.pth, soaplib/soaplib.py{,c,o},
soaplib/__init__.py), and make sys.path longer... I'm not sure it's
worth it for a package with only one or two source files.
(Personally, I feel that as long as dpkg is managing
.../site-packages, I don't really care how many files are in it,
because I never have to look. ;-)
> Also, sorry to get off topic, but should the postinst compile the
> module?
Yes.
> Won't this happen the first time the module is imported?
Only if the user has permissions to write the .pyc/.pyo file, which he
won't if he is non-root and the source is part of a Debian package.
--Rob
--
Rob Tillotson N9MTB <robt@debian.org>
Reply to: