Distributing Python apps
Bjorn Pettersen
BPettersen at NAREX.com
Mon Jan 6 14:17:32 EST 2003
> From: Just van Rossum [mailto:just at letterror.com]
>
> Bjorn Pettersen wrote:
>
> > [ ... ] It seems it might be useful to add a module to the library
> > that emits the graph either through static analysis, or by logging
> > imports during a run. Static analysis could probably catch 95% of
the
> > imports, and even with run-time logging you might be hosed if you
> > don't execute the program path that imports a module. If you combine
> > them I would think you'd get in the 99% range (which I think is
quite
> > acceptable for a language like Python).
>
> Python 2.3a1 contains modulefinder.py (used to be part of the
> Freeze package). It does static import analysis and keeps
> track of which modules import which. It still needs to be
> documented, though... It only misses imports done in exec
> statements and by __import__ calls.
Coolness :-) Let's see someone do that in C++ <grin>. What kind of
documentation are you looking for? (end user, packager developer, doc
strings...)
My favorite part of the code
(http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/dist/src/L
ib/modulefinder.py?rev=1.2&content-type=text/vnd.viewcvs-markup) had to
be:
if op >= dis.HAVE_ARGUMENT:
oparg = ord(code[i]) + ord(code[i+1])*256
i = i+2
black-magic-is-only-for-the-initiated'ly y'rs
-- bjorn
More information about the Python-list
mailing list