This is a smallest possible backport of https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/52
Notable simplifications:
- there is no Lua library
- %python_provide remains untouched and the logic is not shared with %py_provides
- there are no pythonXY-foo provides on Fedora < 33