a patch in matplotlib/__init__.py about get_py2exe_datafiles function

Hi, matplotlib developer

You know there is a bug about get_py2exe_datafiles in MPL0.90.1. I think I fix it below.

------------------------- matplotlib/__init__.py ------------------

def get_py2exe_datafiles():
     datapath = get_data_path()
     head, tail = os.path.split(datapath)
     d = {}
     for root, dirs, files in os.walk(datapath):
         # Need to explicitly remove cocoa_agg files or py2exe complains
         # NOTE I dont know why, but do as previous version
         if 'Matplotlib.nib' in files:
             files.remove('Matplotlib.nil')
         files = [os.path.join(root, filename) for filename in files]
         root = root.replace(tail, 'matplotlibdata')
         root = root[root.index('matplotlibdata'):]
         d[root] = files
     return d.items()

----------------------------- end ---------------------------------

and the sample of setup.py is below:

----------------- setup.py sample -----------------------

from distutils.core import setup
import py2exe

import matplotlib

dist_dir = r'r:\matplotlib_dist_dir'
setup(
     console=['simple_demo.py'],
     options={
              'py2exe': {
                         'packages' : ['matplotlib', 'pytz'],
                         'dist_dir': dist_dir
                        }
             },
     data_files=matplotlib.get_py2exe_datafiles()
)

it work well in my box.

-- Tocer

Hi Tocer,

Thanks for the patch to matplotlib/__init__.py. I changed an obvious
issue ('.nil' to '.nib'), but otherwise committed it as-is. Can you (or
Werner, who was also having this issue) test the current svn version
(>=3418) and report back?

Cheers!
Andrew

tocer wrote:

···

Hi, matplotlib developer

You know there is a bug about get_py2exe_datafiles in MPL0.90.1. I
think I fix it below.

------------------------- matplotlib/__init__.py ------------------

def get_py2exe_datafiles(): datapath = get_data_path() head, tail =
os.path.split(datapath) d = {} for root, dirs, files in
os.walk(datapath): # Need to explicitly remove cocoa_agg files or
py2exe complains # NOTE I dont know why, but do as previous version if 'Matplotlib.nib' in files: files.remove('Matplotlib.nil') files =
[os.path.join(root, filename) for filename in files] root =
root.replace(tail, 'matplotlibdata') root =
root[root.index('matplotlibdata'):] d[root] = files return d.items()

----------------------------- end ---------------------------------

and the sample of setup.py is below:

----------------- setup.py sample -----------------------

from distutils.core import setup import py2exe

import matplotlib

dist_dir = r'r:\matplotlib_dist_dir' setup( console=['simple_demo.py'], options={ 'py2exe': { 'packages' :
['matplotlib', 'pytz'], 'dist_dir': dist_dir } }, data_files=matplotlib.get_py2exe_datafiles() )

it work well in my box.

-- Tocer

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C
- the FREE version of DB2 express and take control of your XML. No
limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/

------------------------------------------------------------------------

_______________________________________________ Matplotlib-users
mailing list Matplotlib-users@lists.sourceforge.net matplotlib-users List Signup and Options