Should fix some buildbot failures.
Most of the import sequence now uses per-module locks rather than the global import lock, eliminating well-known issues with threads and imports.