[Python-Dev] Re: python/dist/src/Lib subprocess.py,NONE,1.1

Bob Ippolito bob at redivi.com
Wed Oct 13 16:45:41 CEST 2004


On Oct 13, 2004, at 8:01 AM, Thomas Heller wrote:

> "Fredrik Lundh" <fredrik at pythonware.com> writes:
>
>> Thomas Heller wrote:
>>
>>> To be honest, I'm against code in the core that depends on whether
>>> pywin32 is installed or not.
>>
>>>> does py2exe support "if 0" blocks?
>>>
>>> py2exe uses modulefinder to scan the byte code of compiled modules, 
>>> and
>>> Python doesn't generate code for 'if 0' blocks, so, yes.
>>
>> just one more question: is there a specific problem with win32all?  
>> if this
>> is a general problem, how do you deal with other optional modules in 
>> the
>> standard library (e.g. _xmlrpclib) ?
>
> If _xmlrpclib is installed, py2exe will find it if the script uses
> xmlrpclib.  I guess that is what the user expects.  If _xmlrpclib is 
> not
> installed, py2exe will warn that it is missing (this warning is 
> probably
> not very useful, and it seems Bob has supressed this warning in 
> py2app).

I have disabled all missing module warnings, because I've found that 
are more of a nuisance than anything else.  However, I have made it 
possible to generate a GraphViz DOT graph of everything that did get 
included, which is useful when you are having problems with too many or 
too few dependencies being included.  Unlike modulefinder, 
py2app.modulegraph keeps track of why modules have been included, so 
it's easy enough to say that "pydoc should not depend on Tkinter", and 
Tkinter won't be included unless something else needs it.

For cases like xmlrpclib->_xmlrpclib or xml -> _xmlplus, with a 
semi-standalone build (depends on an existing Python installation), a 
dotted edge will be drawn between the module that uses xmlrpclib and 
_xmlrpclib.  The graph output only includes modules that ended up in 
the application bundle, so the edge is dotted to represent that the 
dependency exists, but was indirect (since xmlrpclib would not have 
been shown).

That said, if you really wanted to display missing modules, you could 
find them pretty easily from the ModuleGraph instance, just walk it and 
keep instances of MissingModule.

-bob


More information about the Python-Dev mailing list