Code modification for py2app like py2exe

Currently in matplotlib 0.85 we have this to support py2exe starting at
line 392 in __init__.py (Revision: 1.83):

    if sys.platform=='win32' and sys.frozen:
        path = os.path.join(os.path.split(sys.path[0])[0],
'matplotlibdata')
        if os.path.isdir(path): return path
        else:
            # Try again assuming sys.path[0] is a dir not a exe
            path = os.path.join(sys.path[0], 'matplotlibdata')
            if os.path.isdir(path): return path

Wheras modifying line 392 to include darwin as well as win32 we can
allow py2app on OS X to work with matplotlib in the same way that py2exe
does:

    if sys.platform in ('win32','darwin') and sys.frozen:
        path = os.path.join(os.path.split(sys.path[0])[0],
'matplotlibdata')
        if os.path.isdir(path): return path
        else:
            # Try again assuming sys.path[0] is a dir not a exe
            path = os.path.join(sys.path[0], 'matplotlibdata')
            if os.path.isdir(path): return path

I have found this modification useful in making distributable py2app
applications for systems without matplotlib installed.

Richard Bolt
Texmate, Inc.