Fix hacking test to handle namespace packages.

This removes our workaround for namespace packages and improves
detection of missing imports due to non-existent dependencies.

Fixes bug 1130411

Change-Id: I89ee8249580e395f786289792cdf74219d041f2f
Merge "Fix hacking test to handle namespace packages."