developers can specify a different python interpreter by defining the __python macro. although brp-python-bytecompile can use a custom python interpreter specified as $1, the default __os_install_post macro neglects to do so. Suggest trivial fix to /usr/lib/rpm/redhat/macros: s:brp-python-bytecompile \:brp-python-bytecompile %{__python} \:
/usr/lib/rpm/redhat/macros is owned by redhat-rpm-config, not rpm itself...
I noticed this bug, too. If you are building a Python RPM, brp-python-bytecompile will use the system Python for bytecompiling libraries. The correct behavior is to use ./python (the newly built interpreter). Unfortunately, looking at the __python macro probably isn't enough. The correct interpreter also needs to be called with the environment LD_LIBRARY_PATH=".". In cases like this, it would probably best for the RPM creator to manually run: LD_LIBRARY_PATH=. /usr/lib/rpm/brp-python-bytecompile ./python but there needs to be a way to disable automatic bytecompilation.
Fixed in rawhide as of redhat-rpm-config-9.1.0.