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

Re: Correct location of .py and .pyc files



[Ugh, sorry for the double message, Marco]

Marco Paganini <paganini-debian-lists@paganini.net> wrote:

> Hi All,

Hi,

> I need to package a Python application that depends on multiple modules.
> I've been wondering about the correct location for the modules (both .py and
> .pyc files) in Debian. FHS states that architecture independent files should
> go under /usr/share/packagename, which was my first guess at where to put
> them.  However, I checked some packages in the repository and they put those
> files in /usr/lib/packagename (!?). What is, after all, the blessed location
> for these files?

I think the status quo is: /usr/share would be better, but is not
supported upstream, and no one yet has been willing to put the energy
needed to solve this problem. OTOH, there could be some weird cases
where a Python script would be intended for specific architectures
(hence would have to live in /usr/lib), but I think most of them would
be fairly pathological and could be changed to work in /usr/share.

As for now, the best location for these modules is
/usr/lib/pythonX.Y/site-packages. If the modules are
Python-version-independent, /usr/lib/python/site-packages (looks
deprecated; I have /usr/lib/site-python on my sid chroot instead) with
some mecanism like python-central would be better, but it seems to me it
isn't officially supported (there is no python-central package in
unstable and no register-python-package command in the
python(x.y)?(-dev)? packages), even though I used it on a package of
mine in my private apt repository, and found it to work well.

> Another point is what should be done with the "compiled" versions? Should the
> package installation scripts pre-compile the modules for faster execution?

Yes, but obviously you haven't read the Python policy draft
(/usr/share/doc/python/python-policy.txt.gz) nor Josselin's proposal at
http://people.debian.org/~joss/python/python-policy-draft.html/index.html.
They are must reads for anyone packaging something that is
python-related.

-- 
Florent



Reply to: