Detecting real python (perl/ruby/.so/...) dependencies

Mike Brown mike at skew.org
Tue Dec 19 08:58:06 PST 2006


Andrew Pantyukhin wrote:
> So I need to find out what modules does a particu-
> lar python program require. I can grep for import,
> but many modules are present in our python bundle.

This is a common requirement for things like freeze and py2exe.

One place to start is probably modulefinder (in python stdlib)
http://docs.python.org/lib/module-modulefinder.html

You might want to ask on python-list for strategies people use
for finding non-obvious, "hidden" imports.

In 4Suite, which has many such hidden imports, we ended up
maintaining our own mappings in our extensions to distutils.

A few things to look at:
http://cvs.4suite.org/viewcvs/4Suite/Ft/Lib/DistExt/ModuleFinder.py?view=markup
http://cvs.4suite.org/viewcvs/4Suite/Ft/Lib/ImportUtil.py?view=markup
http://cvs.4suite.org/viewcvs/4Suite/Ft/Lib/DistExt/Py2Exe.py?view=markup

The idea with the latter is that people who want to use py2exe can do "from
Ft.Lib.DistExt import Py2Exe" instead of "import py2exe" in their setup.py.

I don't fully understand how this end of our stuff works, myself, but if you
ask on 4suite-dev, I'm sure the principal author of that code can help.

Mike


More information about the freebsd-ports mailing list