[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Executable creation blues



On 9/28/06, Jasper <jasper@xxxxxxxx> wrote:
Bob Ippolito wrote:

> On 9/28/06, Jasper <jasper@xxxxxxxx> wrote:
>
>> Sami Hangaslammi wrote:
>>
>> > I'd still like to hear why the original poster found PyPack
>> > unsuitable, (so that I could improve it), since it, for example, gets
>> > around both of the numpy/Numeric problems posted by Brian.
>>
>> Partly because it apparently didn't like having an entry script
>> somewhere other than the root directory (although I didn't fiddle around
>> with this much so I could easily be missing something), but mostly
>> because I didn't think the method of tracing execution to find imports
>> was robust, in particular if you have dynamic imports.  In retrospect I
>> bet py2exe doesn't handle this either, so I'll give Pypack another try.
>>
>
> Your reasoning is totally backwards.
>
> py2exe (and just about everything else) uses a less robust way of
> tracking imports -- it examines bytecode, which will never find
> dynamic imports. Tracing execution will generally find all imports, so
> long as your code isn't pathologically dynamic.


In hindsight I see this, and posted that too quickly (I'm really itching to get this working).

IMHO you're wrong that code needs to be "pathologically dynamic" to use
dynamic imports.  I find it an entirely reasonable way to load dynamic
code and content.  I don't make much use of it now, but plan to as an
easy means game modding.

... but those mods almost by definition probably aren't going to live in-executable.

It's still pathological in the mathematical/computer science sense of
pathological in that code that does dynamic imports fails to conform
to generic behavior. The large majority of code does not need and
would not benefit from dynamic imports.

The other pathological case is where a C extension invokes the import
machinery, which happens a bunch in the stdlib (e.g. importing codecs,
warnings, etc.). py2app has complete coverage of these scenarios in
the stdlib (as of Python 2.4, anyway), but I don't believe that py2exe
does.

-bob