Discover fixes

Backport the fix for discovery in packages from Python bugtracker.
IIUC, this means we won't discover packages with only *.pyc files. Does this matter? Probably not for almost all of our users, I guess.