Skip to content

Commit 2e51d0a

Browse files
committed
Patch for get_py2exe_datafiles() to work with new directory layout. (Thanks Tocer and also Werner Bruhin.)
svn path=/trunk/matplotlib/; revision=3418
1 parent 2dc560e commit 2e51d0a

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

CHANGELOG

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2007-06-27 Patch for get_py2exe_datafiles() to work with new directory
2+
layout. (Thanks Tocer and also Werner Bruhin.) -ADS
3+
14
2007-06-27 Added a scroll event to the mpl event handling system and
25
implemented it for backends GTK* -- other backend
36
users/developers/maintainers, please add support for your

lib/matplotlib/__init__.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,19 @@ def _get_data_path():
369369
get_data_path = verbose.wrap('matplotlib data path %s', _get_data_path, always=False)
370370

371371
def get_py2exe_datafiles():
372-
import glob
373-
374-
mplfiles = glob.glob(os.sep.join([get_data_path(), '*']))
375-
# Need to explicitly remove cocoa_agg files or py2exe complains
376-
mplfiles.remove(os.sep.join([get_data_path(), 'Matplotlib.nib']))
377-
378-
return ('matplotlibdata', mplfiles)
372+
datapath = get_data_path()
373+
head, tail = os.path.split(datapath)
374+
d = {}
375+
for root, dirs, files in os.walk(datapath):
376+
# Need to explicitly remove cocoa_agg files or py2exe complains
377+
# NOTE I dont know why, but do as previous version
378+
if 'Matplotlib.nib' in files:
379+
files.remove('Matplotlib.nib')
380+
files = [os.path.join(root, filename) for filename in files]
381+
root = root.replace(tail, 'matplotlibdata')
382+
root = root[root.index('matplotlibdata'):]
383+
d[root] = files
384+
return d.items()
379385

380386
def checkdep_dvipng():
381387
try:

0 commit comments

Comments
 (0)