Revision: 8776 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8776&view=rev Author: jouni Date: 2010-11-07 08:06:41 +0000 (Sun, 07 Nov 2010)
Log Message: ----------- Allow bypassing the download mechanism in get_sample_data Modified Paths: -------------- branches/v1_0_maint/CHANGELOG branches/v1_0_maint/lib/matplotlib/cbook.py branches/v1_0_maint/lib/matplotlib/rcsetup.py branches/v1_0_maint/matplotlibrc.template Modified: branches/v1_0_maint/CHANGELOG =================================================================== --- branches/v1_0_maint/CHANGELOG 2010-11-05 18:52:52 UTC (rev 8775) +++ branches/v1_0_maint/CHANGELOG 2010-11-07 08:06:41 UTC (rev 8776) @@ -1,3 +1,7 @@ +2010-11-07 New rc parameters examples.download and examples.directory + allow bypassing the download mechanism in get_sample_data. + - JKS + 2010-08-21 Change Axis.set_view_interval() so that when updating an existing interval, it respects the orientation of that interval, and can enlarge but not reduce the interval. Modified: branches/v1_0_maint/lib/matplotlib/cbook.py =================================================================== --- branches/v1_0_maint/lib/matplotlib/cbook.py 2010-11-05 18:52:52 UTC (rev 8775) +++ branches/v1_0_maint/lib/matplotlib/cbook.py 2010-11-07 08:06:41 UTC (rev 8776) @@ -649,9 +649,20 @@ svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data and svn add the data file you want to support. This is primarily - intended for use in mpl examples that need custom data + intended for use in mpl examples that need custom data. + + To bypass all downloading, set the rc parameter examples.download to False + and examples.directory to the directory where we should look. """ + if not matplotlib.rcParams['examples.download']: + directory = matplotlib.rcParams['examples.directory'] + f = os.path.join(directory, fname) + if asfileobj: + return open(f, 'rb') + else: + return f + myserver = get_sample_data.myserver if myserver is None: configdir = matplotlib.get_configdir() Modified: branches/v1_0_maint/lib/matplotlib/rcsetup.py =================================================================== --- branches/v1_0_maint/lib/matplotlib/rcsetup.py 2010-11-05 18:52:52 UTC (rev 8775) +++ branches/v1_0_maint/lib/matplotlib/rcsetup.py 2010-11-07 08:06:41 UTC (rev 8776) @@ -566,8 +566,12 @@ 'keymap.grid' : ['g', validate_stringlist], 'keymap.yscale' : ['l', validate_stringlist], 'keymap.xscale' : [['k', 'L'], validate_stringlist], - 'keymap.all_axes' : ['a', validate_stringlist] + 'keymap.all_axes' : ['a', validate_stringlist], + # sample data + 'examples.download' : [True, validate_bool], + 'examples.directory' : ['', str], + } if __name__ == '__main__': Modified: branches/v1_0_maint/matplotlibrc.template =================================================================== --- branches/v1_0_maint/matplotlibrc.template 2010-11-05 18:52:52 UTC (rev 8775) +++ branches/v1_0_maint/matplotlibrc.template 2010-11-07 08:06:41 UTC (rev 8776) @@ -370,3 +370,12 @@ #keymap.xscale : L, k # toggle scaling of x-axes ('log'/'linear') #keymap.all_axes : a # enable all axes +# Control downloading of example data. Various examples download some +# data from the Matplotlib svn repository to avoid distributing extra +# files, but sometimes you want to avoid that. In that case set +# examples.download to False and examples.directory to the directory +# where you have a checkout of +# https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data + +#examples.download : True # False to bypass downloading mechanism +#examples.directory : '' # absolute directory to look in if download is false This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins