On Jul 14, 2010, at 10:56 AM, Suno Ano wrote: >Yes, that is a common question people have when they want to know how >exactly things are handled in Debian. It was the same for me so I >created > >http://www.markus-gattol.name/ws/python.html#why_has_debian_dist-packages_directories Hi Suno. Thanks for writing this page; I have a few comments on some of the details. First, when Python searches for a module to import, only sys.path is consulted (modulo other import hooks). It doesn't really treat $PYTHONPATH or the cwd any differently. It does initialize sys.path from $PYTHONPATH and it does (sometimes) include a special marker (the empty string) first on sys.path to indicate the cwd, but once Python's machinery gets going $PYTHONPATH is ignored. Second, my recollection about *why* Debian's Python >= 2.6 uses dist-packages instead of site-packages is different. Long before becoming more active here, I raised a problem (I think on this list, and with Doko) that some folks were having because of conflicts surrounding the FHS. Debian put /usr/local/lib/pythonX.Y/site-packages on the system Python's sys.path because it interprets the FHS to allow/encourage/require system administrators to install non-standard stuff to /usr/local. Generally, I agreed with this, but this conflicted with 15 or so years of established practice in upstream Python. A from-source install of Python by default goes into /usr/local and *also* has /usr/local/lib/pythonX.Y on sys.path. This means that if you install Python from-source, as many Python developers do through the default cmmi build, and system administrators do achieve Python builds isolated from critical system resources, you could break your system Python by installing incompatible packages into what you thought was an isolated environment. Yes, this happened to me :) but I wasn't alone. Because it was unlikely upstream Python was going to change (e.g. to install from source by default into /opt) or that Debian Python policy was going to change, Doko came up with a clever compromise of changing the system Python's /usr/local claim to be dist-packages instead (mirrored to /usr/lib space for convenience and consistency). This seemed like a perfectly workable solution, which I still agree with, despite the mild surprise factor for seasoned non-Debian-versed Python developers. Anyway, I think it would be useful to elaborate on this in the Debian Python wiki, though I won't have time to add this for now. Cheers, -Barry
Attachment:
signature.asc
Description: PGP signature