[Python-modules-commits] r22955 - in packages/matplotlib/trunk/debian (3 files)

morph at users.alioth.debian.org morph at users.alioth.debian.org
Sat Nov 10 22:01:46 UTC 2012


    Date: Saturday, November 10, 2012 @ 22:01:43
  Author: morph
Revision: 22955

* debian/patches/60_bts691960_reintroduce_examples.directory_rcparam.patch
  - reintroduce (removed in 1.2.x series) 'examples.directory' rc parameter,
    in order to specify the Debian custom sample_data path; thanks to Julian
    Taylor for the report; Closes: #691960

Added:
  packages/matplotlib/trunk/debian/patches/60_bts691960_reintroduce_examples.directory_rcparam.patch
Modified:
  packages/matplotlib/trunk/debian/changelog
  packages/matplotlib/trunk/debian/patches/series

Modified: packages/matplotlib/trunk/debian/changelog
===================================================================
--- packages/matplotlib/trunk/debian/changelog	2012-11-10 20:14:18 UTC (rev 22954)
+++ packages/matplotlib/trunk/debian/changelog	2012-11-10 22:01:43 UTC (rev 22955)
@@ -8,8 +8,12 @@
   * debian/rules
     - no longer set examples.* options in matplotlibrc when building doc (they
       are not needed with 1.2.0)
+  * debian/patches/60_bts691960_reintroduce_examples.directory_rcparam.patch
+    - reintroduce (removed in 1.2.x series) 'examples.directory' rc parameter,
+      in order to specify the Debian custom sample_data path; thanks to Julian
+      Taylor for the report; Closes: #691960
 
- -- Sandro Tosi <morph at debian.org>  Fri, 09 Nov 2012 20:19:38 +0100
+ -- Sandro Tosi <morph at debian.org>  Sat, 10 Nov 2012 18:28:00 +0100
 
 matplotlib (1.2.0~rc2-2) experimental; urgency=low
 

Added: packages/matplotlib/trunk/debian/patches/60_bts691960_reintroduce_examples.directory_rcparam.patch
===================================================================
--- packages/matplotlib/trunk/debian/patches/60_bts691960_reintroduce_examples.directory_rcparam.patch	                        (rev 0)
+++ packages/matplotlib/trunk/debian/patches/60_bts691960_reintroduce_examples.directory_rcparam.patch	2012-11-10 22:01:43 UTC (rev 22955)
@@ -0,0 +1,81 @@
+Description: Reintroduce examples.directory rc parameter
+Forwarded: https://github.com/matplotlib/matplotlib/pull/1479
+Bug-Debian: http://bugs.debian.org/691960
+Author: Sandro Tosi <morph at debian.org>
+
+--- a/lib/matplotlib/__init__.py
++++ b/lib/matplotlib/__init__.py
+@@ -825,6 +825,20 @@ Please do not ask for support with these
+ # 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 \
+--- a/lib/matplotlib/cbook.py
++++ b/lib/matplotlib/cbook.py
+@@ -21,6 +21,7 @@ import traceback
+ import warnings
+ from weakref import ref, WeakKeyDictionary
+ 
++import matplotlib
+ 
+ import numpy as np
+ import numpy.ma as ma
+@@ -570,9 +571,17 @@ def get_sample_data(fname, asfileobj=Tru
+     `mpl-data/sample_data` directory.  If *asfileobj* is `True`
+     return a file object, otherwise just a file path.
+ 
++    Set the rc parameter examples.directory to the directory where we should
++    look, if sample_data files are stored in a location different than
++    default (which is 'mpl-data/sample_data` at the same level of 'matplotlib`
++    Python module files).
++
+     If the filename ends in .gz, the file is implicitly ungzipped.
+     """
+-    root = os.path.join(os.path.dirname(__file__), "mpl-data", "sample_data")
++    if matplotlib.rcParams['examples.directory']:
++        root = matplotlib.rcParams['examples.directory']
++    else:
++        root = os.path.join(os.path.dirname(__file__), "mpl-data", "sample_data")
+     path = os.path.join(root, fname)
+ 
+     if asfileobj:
+--- a/lib/matplotlib/rcsetup.py
++++ b/lib/matplotlib/rcsetup.py
+@@ -616,6 +616,9 @@ defaultParams = {
+     'keymap.xscale' : [['k', 'L'], validate_stringlist],
+     'keymap.all_axes' : ['a', validate_stringlist],
+ 
++    # sample data
++    'examples.directory' : ['', str],
++
+     # Animation settings
+     'animation.writer' : ['ffmpeg', validate_movie_writer],
+     'animation.codec' : ['mpeg4', str],
+--- a/matplotlibrc.template
++++ b/matplotlibrc.template
+@@ -423,6 +423,9 @@ text.hinting_factor : 8 # Specifies the
+ #keymap.xscale : L, k                # toggle scaling of x-axes ('log'/'linear')
+ #keymap.all_axes : a                 # enable all axes
+ 
++# Control location of examples data files
++examples.directory : /usr/share/matplotlib/sample_data
++
+ ###ANIMATION settings
+ #animation.writer : ffmpeg         # MovieWriter 'backend' to use
+ #animation.codec : mp4             # Codec to use for writing movie

Modified: packages/matplotlib/trunk/debian/patches/series
===================================================================
--- packages/matplotlib/trunk/debian/patches/series	2012-11-10 20:14:18 UTC (rev 22954)
+++ packages/matplotlib/trunk/debian/patches/series	2012-11-10 22:01:43 UTC (rev 22955)
@@ -2,3 +2,4 @@
 20_matplotlibrc_path_search_fix.patch
 40_bts608939_draw_markers_description.patch
 50_bts608942_spaces_in_param_args.patch
+60_bts691960_reintroduce_examples.directory_rcparam.patch




More information about the Python-modules-commits mailing list