reinout/z3c.dependencychecker — pull request #2 by jone (2012-07-02 16:33:57+00:00)
Title: Lookup pkg name from egg-infos if possible (python >= 2.5).

I've added guessing the real package name of the imported modules.

This is useful when the dotted name of the import does not match the package name (e.g. Products.Five is in Zope2).
It also allows to copy the output to the requires list more easily.
It gives less but more precies output.

**Behaviour**

- When importing multiple from modules of the same package the package name only appears once.
- When it is not possible to import the module it falls back to the default behavior.
- It only supports python >= 2.5 since it uses ``runpy``. For older versions it safely falls back to the previous behavior.

**Discussion**

- Tests are still passing but I didn't add tests since I was nut sure how would be the best way to do it.
- The modules are actually imported by ``pyrun`` for beeing able to locate the module. This may be a performance issue on big projects - should a command line argument be added?