Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Dec 2006 09:22:57 -0700 (MST)
From:      Mike Brown <mike@skew.org>
To:        Andrew Pantyukhin <infofarmer@freebsd.org>
Cc:        FreeBSD Ports <ports@freebsd.org>
Subject:   Re: Detecting real python (perl/ruby/.so/...) dependencies
Message-ID:  <200612191622.kBJGMv6r097480@chilled.skew.org>
In-Reply-To: <cb5206420612190647k3ce21c6ag81c274fb1a39aefc@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200612191622.kBJGMv6r097480>