Revision: 4654
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4654&view=rev
Author:   dsdale
Date:     2007-12-06 11:18:49 -0800 (Thu, 06 Dec 2007)

Log Message:
-----------
updated references to mpl data directories for py2exe

Modified Paths:
--------------
    trunk/matplotlib/CHANGELOG
    trunk/matplotlib/lib/matplotlib/__init__.py
    trunk/matplotlib/lib/matplotlib/config/cutils.py

Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG  2007-12-06 19:10:12 UTC (rev 4653)
+++ trunk/matplotlib/CHANGELOG  2007-12-06 19:18:49 UTC (rev 4654)
@@ -1,3 +1,5 @@
+2007-12-06 updated references to mpl data directories for py2exe - DSD
+
 2007-12-06 fixed a bug in rcsetup, see bug 1845057 - DSD
 
 ===============================================================

Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py 2007-12-06 19:10:12 UTC (rev 
4653)
+++ trunk/matplotlib/lib/matplotlib/__init__.py 2007-12-06 19:18:49 UTC (rev 
4654)
@@ -428,11 +428,16 @@
 
     # py2exe zips pure python, so still need special check
     if getattr(sys,'frozen',None):
-        path = os.path.join(os.path.split(sys.path[0])[0], 'matplotlibdata')
+        path = os.path.join(os.path.split(sys.path[0])[0], 'mpl-data')
         if os.path.isdir(path): return path
         else:
+            # Try again assuming we need to step up one more directory
+            path = 
os.path.join(os.path.split(os.path.split(sys.path[0])[0])[0],
+                                'mpl-data')
+        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')
+            path = os.path.join(sys.path[0], 'mpl-data')
             if os.path.isdir(path): return path
 
     raise RuntimeError('Could not find the matplotlib data files')
@@ -442,7 +447,8 @@
         defaultParams['datapath'][0] = _get_data_path()
     return defaultParams['datapath'][0]
 
-get_data_path = verbose.wrap('matplotlib data path %s', _get_data_path_cached, 
always=False)
+get_data_path = verbose.wrap('matplotlib data path %s', _get_data_path_cached,
+                             always=False)
 
 def get_py2exe_datafiles():
     datapath = get_data_path()
@@ -454,8 +460,8 @@
         if 'Matplotlib.nib' in files:
             files.remove('Matplotlib.nib')
         files = [os.path.join(root, filename) for filename in files]
-        root = root.replace(tail, 'matplotlibdata')
-        root = root[root.index('matplotlibdata'):]
+        root = root.replace(tail, 'mpl-data')
+        root = root[root.index('mpl-data'):]
         d[root] = files
     return d.items()
 

Modified: trunk/matplotlib/lib/matplotlib/config/cutils.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/cutils.py    2007-12-06 19:10:12 UTC 
(rev 4653)
+++ trunk/matplotlib/lib/matplotlib/config/cutils.py    2007-12-06 19:18:49 UTC 
(rev 4654)
@@ -77,7 +77,7 @@
     if os.path.exists(p):
         if not is_writable_dir(p):
             raise RuntimeError("""\
-'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. 
+'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir.
 You can also set environment variable MPLCONFIGDIR to any writable directory
 where you want matplotlib data stored """%h)
     else:
@@ -110,11 +110,16 @@
 
     # py2exe zips pure python, so still need special check
     if getattr(sys,'frozen',None):
-        path = os.path.join(os.path.split(sys.path[0])[0], 'matplotlibdata')
+        path = os.path.join(os.path.split(sys.path[0])[0], 'mpl-data')
         if os.path.isdir(path): return path
         else:
+            # Try again assuming we need to step up one more directory
+            path = 
os.path.join(os.path.split(os.path.split(sys.path[0])[0])[0],
+                                'mpl-data')
+        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')
+            path = os.path.join(sys.path[0], 'mpl-data')
             if os.path.isdir(path): return path
 
     raise RuntimeError('Could not find the matplotlib data files')
@@ -136,8 +141,8 @@
         if 'Matplotlib.nib' in files:
             files.remove('Matplotlib.nib')
         files = [os.path.join(root, filename) for filename in files]
-        root = root.replace(tail, 'matplotlibdata')
-        root = root[root.index('matplotlibdata'):]
+        root = root.replace(tail, 'mpl-data')
+        root = root[root.index('mpl-data'):]
         d[root] = files
     return d.items()
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to