From python3.11.spec: # 00328 # 318e500c98f5e59eb1f23e0fcd32db69b9bd17e1 # Restore pyc to TIMESTAMP invalidation mode as default in rpmbuild # # Since Fedora 31, the $SOURCE_DATE_EPOCH is set in rpmbuild to the latest # %%changelog date. This makes Python default to the CHECKED_HASH pyc # invalidation mode, bringing more reproducible builds traded for an import # performance decrease. To avoid that, we don't default to CHECKED_HASH # when $RPM_BUILD_ROOT is set (i.e. when we are building RPM packages). # # See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426 # Downstream only: only used when building RPM packages # Ideally, we should talk to upstream and explain why we don't want this Patch328: 00328-pyc-timestamp-invalidation-mode.patch
Previously tracked in BZ#1287556.
This should be solved by __pysource__, if accepted upstream: https://discuss.python.org/t/pysource-file-layout-for-installed-modules/14594
I figured out we can pass --invalidation-mode=timestamp to compilall when we byte-compile explicitly and we don't need to care about other use cases that much. See https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/154 and https://src.fedoraproject.org/rpms/python3.12/pull-request/17