we are considering to add a %pycached macro to be used in the %files section:
We'd like to receive feedback. We plan to add it to rawhide and backport it to
all Fedoras + EPEL7+.
This will list:
Assuming the Python 3 version is 3.8.
The bytecode files are globbed, their presence is not checked.
This will fail:
error: %pycached can only be used with paths explicitly ending with .py
And so will any of this:
But this will work:
And it will generate the following globs:
When used with paths that include Python 3 version, it globs with the version:
While paths without version have less strict globs:
This will generate a warning in RPM build:
warning: File listed twice: /custom/__pycache__/foo.cpython-38.opt-1.pyc
However it ensures the optimized bytecode is there.