use importlib.machinery when available

avoids deprecation warning on startup, and allows tests to pass with PYTHONWARNINGS=d

closes #4051

candidate for backport to 1.2
Merge pull request #4928 from minrk/suffixes

use importlib.machinery when available