Use the canonical `importlib.metadata.entry_points` instead, and a well defined fallback for older Python versions. Fix #2404