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

Re: [pygame] BUG: required modules not raising error when failing to import was Re: [pygame] Surfarray.array_alpha() bugfix, py2exe/py2app segfault



I know little about py2exe/py2app other than they tend to overlook modules. But a setup file that bundles the unit tests could be included in the distribution directory. Or, it could be made a unit test itself. Then we would have an infinite regression test.

Yes, errors should be raised for missing modules. It would also keep Pygame's setup file honest. A bufferproxy import also needs to be added to __init__.py, which I will do now.

Lenard


René Dudfield wrote:
hi,

how about a test which creates apps with py2exe and py2app etc and
then runs the tests?

That way we should be able to test if the created exe's are working
correctly with all the unittested parts of pygame.

I too prefer making it a requirement... and raising import error if it
is not there.

cheers,


On Wed, Feb 4, 2009 at 2:40 PM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
Hi,

Zack Schilling has the distinction of being the first Pygame developer to
use py2app/py2exe to wrap a game using NumPy. Before that no one noticed
bufferproxy was missing.

So where to generate the import errors. bufferproxy is not critical to
surface unless some other module needs a surface buffer. Either
Surface.get_buffer can check for NULL pointers and raise an
NotImplementedError if bufferproxy is missing or bufferproxy is made a
requirement for surface to import properly. The former option could save a
little space if array packages are not used, but is potentially confusing.
Since buffers may be used elsewhere I prefer the later option myself.

A missing surflock already raises an ImportError. So for the surface module
that leaves base, rect and color.

I suppose another possibly overlooked module is rwobject. That will need to
be investigated as well.

Lenard


René Dudfield wrote:
ah yes, good one.


On Wed, Feb 4, 2009 at 2:07 PM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:

Simple. The bufferproxy module is not included in the executables. I
would
also check for surflock.

The moral of the story, when critical modules are missing, they should
not
be quietly ignored. An exception has to be raised. Brian Fisher did this
with _numericsurfarray when Numeric is missing. It simply fails to
import. I
did the same for _numericsndarray. Now it needs to be done for Pygame
extention modules that rely on other Pygame modules.


--
Lenard Lindstrom
<len-l@xxxxxxxxx>




--
Lenard Lindstrom
<len-l@xxxxxxxxx>