|
From: <jd...@us...> - 2011-01-06 19:42:14
|
Revision: 8899
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8899&view=rev
Author: jdh2358
Date: 2011-01-06 19:42:08 +0000 (Thu, 06 Jan 2011)
Log Message:
-----------
support relative paths in examples.directory
Modified Paths:
--------------
branches/v1_0_maint/doc/matplotlibrc
branches/v1_0_maint/lib/matplotlib/__init__.py
Modified: branches/v1_0_maint/doc/matplotlibrc
===================================================================
--- branches/v1_0_maint/doc/matplotlibrc 2011-01-06 13:57:51 UTC (rev 8898)
+++ branches/v1_0_maint/doc/matplotlibrc 2011-01-06 19:42:08 UTC (rev 8899)
@@ -8,6 +8,8 @@
# w/o invoking file downloads for the sampledata (see
# matplotlib.cbook.get_sample_data. Unpack
# mpl_sampledata-VERSION.tar.gz and point examples.directory to it.
+# You can use a relative path for examples.directory and it must be
+# relative to this matplotlibrc file
#examples.download : False # False to bypass downloading mechanism
-#examples.directory : /home/titan/johnh/python/svn/matplotlib.trunk/sample_data/ # directory to look in if download is false
+#examples.directory : /your/path/to/sample_data/ # directory to look in if download is false
Modified: branches/v1_0_maint/lib/matplotlib/__init__.py
===================================================================
--- branches/v1_0_maint/lib/matplotlib/__init__.py 2011-01-06 13:57:51 UTC (rev 8898)
+++ branches/v1_0_maint/lib/matplotlib/__init__.py 2011-01-06 19:42:08 UTC (rev 8899)
@@ -762,6 +762,21 @@
# this is the instance used by the matplotlib classes
rcParams = rc_params()
+
+if rcParams['examples.directory']:
+ # paths that are intended to be relative to matplotlib_fname()
+ # are allowed for the examples.directory parameter.
+ # However, we will need to fully qualify the path because
+ # Sphinx requires absolute paths.
+ if not os.path.isabs(rcParams['examples.directory']):
+ _basedir, _fname = os.path.split(matplotlib_fname())
+ # Sometimes matplotlib_fname() can return relative paths,
+ # Also, using realpath() guarentees that Sphinx will use
+ # the same path that matplotlib sees (in case of weird symlinks).
+ _basedir = os.path.realpath(_basedir)
+ _fullpath = os.path.join(_basedir, rcParams['examples.directory'])
+ rcParams['examples.directory'] = _fullpath
+
rcParamsOrig = rcParams.copy()
rcParamsDefault = RcParams([ (key, default) for key, (default, converter) in \
@@ -770,6 +785,8 @@
rcParams['ps.usedistiller'] = checkdep_ps_distiller(rcParams['ps.usedistiller'])
rcParams['text.usetex'] = checkdep_usetex(rcParams['text.usetex'])
+
+
def rc(group, **kwargs):
"""
Set the current rc params. Group is the grouping for the rc, eg.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|