Python byte-compilation: installation path

tlaronde at kergis.com tlaronde at kergis.com
Tue Mar 12 12:40:03 UTC 2024


In xcb-proto, for example, there are python files that are supposed to
be byte-compiled at installation time.

There are two problems:

1) The python version to use is defined at configuration time; while,
since python is not required at "compilation" time, it would be better
to have a package that can be installed anywhere, the python
version(s) to compile for being decided at installation time;

2) The installation is put in a versioned python subdir, and the
pkgconfig file is defined with a setup time python path definition;
while it would be better to post-process the pc file to replace magic
strings according to the paths decided at installation time.

But, for me moment, the path defined for python module installation is
versioned. While, in fact, the sources (.py) files could be shared (not
versioning the python) and the compiled version (.pyc or .pyo) could be
versioned in a common __pycache__ subdir, according to:

https://peps.python.org/pep-3147/

What is the rationale for versioning? So that if one python version is
deinstalled, removing a subdir will get rid of the related
byte-compiled files without having to prune a common subdir, searching
for byte-compiled files that are not useful for the (potentially)
remaining concurrent python installations (different python versions
installed on a same node)?
-- 
        Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


More information about the xorg-devel mailing list