Fix NoPackagesFound for recursive dependencies (fixes #666)

Just putting this in a pull request so I can make sure it is good before merging into master.