Python C.I. woes

tlaronde at kergis.com tlaronde at kergis.com
Thu Jun 13 15:55:36 UTC 2024


For comparing the result of an Autotools build and installation
against the Meson ones, comparing byte by byte is failing for several
reasons:

	1) The generated pkg-config file(s) may have, in the
_definitions_ of variables, different uses of variables. This has been
addressed by writing (xorg/util/modular) the script
auto-meson-pc-cmp.sh that compares semantically and not literally what
is in the produced pc files, the only thing important being that an
equivalent configuration should yield eventually the same definitions;

	2) For python byte-compiled files, the problems are more
numerous and tricky:
		a) The byte-compiled version, in order to track its
validity against the source version, records a path to the source; for
this I was hit by path recorded incorporating the DESTDIR prefix, that
should be removed. The problem is that the module "compileall" that
seemed the more handy to use doesn't work correctly when using "-d"
(it records the path as DESTDIR/$(basename $file) which is
definitively not what is wanted) and -p DESTDIR removed the first '/'
of the real absolute path => so I will have to go the same way as
Autotools py-compile, that is calling the compile module file by file
and setting all the arguments; so this should be addressable;

		b) It records also, by default, the mtime of the
source. I will try SOURCE_DATE_EPOCH since it seems supported by
Python, and will set it as a global variable of the pipeline;

		c) py-compile generates by default 0 (non optimized)
and 1 (without debug statements) but not 2 (without debug and
docstrings) because, probably, 2.7 was generating the byte-compiled
with a uniq suffix: .pyo, for levels 1 and 2, so the script was not
adapted to try 2 with Python 3.5+. So I will stick to 0 and 1 for now.

Has someone already had to play with these Python features and found
better solutions?
-- 
        Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
                     http://nunc-et-hic.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


More information about the xorg-devel mailing list