[cmake][py] Add version detection via importlib.metadata for Python >= 3.8

This is necessary as the fallback is using pkg_resources which has been deprecated and was removed in Python 3.12.

Merge request reports

Loading