Python libs on Debian/Raspbian

Richard Laager rlaager at
Wed Dec 20 06:35:48 UTC 2017

On 12/19/2017 10:23 PM, Gary E. Miller via devel wrote:
>> F) .pth file in /usr/.../pythonX.Y/....-packages
> Uh, no.  I looked at this some more.  That first ... can only be lib,
> lib32 or lib64.  Waf can not write there, Python only looks there.

Agreed. We can either tell the user to write there, or violate PREFIX
(minimally). I advocated the former, Fred Wright advocated the latter.

>> G) utilities look at argv[0] path and modify sys.path
> Hmm.  I just tried that, no good.  Here is what I get for argv:

So Python is not C-like in this regard. I hadn't actually tested, and
was mainly using that as shorthand. But it sounds like you've found
something that works:
>     os.path.dirname(os.path.realpath(__file__)
> And funny about the cron, sudo, openrc, etc. environments.  I seem to
> have no difficulty at all setting environment variables in there.

I can set things there too, but: a) it involves duplicating the
environment variable in multiple places, and b) other people do have

The more I think about it, the more I'm liking option H (waf puts
PYTHONDIR into the executables). That Just Works, without requiring the
user to do anything. It doesn't violate PREFIX even a little. As Matt
pointed out, it also allows for hard-coding the she-bang to match.

It does break if the user moves the python module, but I don't think
that's a use case worth supporting. Uninstalling and reinstalling is
always an option. Matt is correct, distro builds would work fine.

I personally don't think it is necessary to support multiple versions
installed simultaneously, but option H should make that work. I agree
that the in-working-dir unit testing is critical to keep working.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the devel mailing list