Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b2830aa

Browse filesBrowse files
committed
Merge remote-tracking branch 'upstream/v1.3.x'
Conflicts: lib/matplotlib/__init__.py setup.py
2 parents fc6a048 + 6d8c067 commit b2830aa
Copy full SHA for b2830aa

File tree

Expand file treeCollapse file tree

17 files changed

+2802
-61
lines changed
Filter options
Expand file treeCollapse file tree

17 files changed

+2802
-61
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ python:
1717
- 3.3
1818

1919
install:
20-
- pip install -q --use-mirrors nose python-dateutil numpy pep8 pyparsing
21-
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then pip -q install --use-mirrors PIL; fi
20+
- pip install -q --use-mirrors nose python-dateutil numpy pep8 pyparsing pillow
2221
- sudo apt-get update && sudo apt-get -qq install inkscape
2322
- python setup.py install
2423

‎doc/users/whats_new.rst

Copy file name to clipboardExpand all lines: doc/users/whats_new.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Enhancements
7373
- Added a context manager for creating multi-page pdfs (see
7474
`matplotlib.backends.backend_pdf.PdfPages`).
7575

76-
- The WebAgg backend should no have lower latency over heterogeneous
76+
- The WebAgg backend should now have lower latency over heterogeneous
7777
Internet connections.
7878

7979
Bug fixes

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+44-28Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -330,23 +330,22 @@ def checkdep_dvipng():
330330
return None
331331

332332
def checkdep_ghostscript():
333-
try:
334-
if sys.platform == 'win32':
335-
gs_execs = ['gswin32c', 'gswin64c', 'gs']
336-
else:
337-
gs_execs = ['gs']
338-
for gs_exec in gs_execs:
333+
if sys.platform == 'win32':
334+
gs_execs = ['gswin32c', 'gswin64c', 'gs']
335+
else:
336+
gs_execs = ['gs']
337+
for gs_exec in gs_execs:
338+
try:
339339
s = subprocess.Popen(
340340
[gs_exec, '--version'], stdout=subprocess.PIPE,
341341
stderr=subprocess.PIPE)
342342
stdout, stderr = s.communicate()
343343
if s.returncode == 0:
344344
v = stdout[:-1]
345345
return gs_exec, v
346-
347-
return None, None
348-
except (IndexError, ValueError, OSError):
349-
return None, None
346+
except (IndexError, ValueError, OSError):
347+
pass
348+
return None, None
350349

351350
def checkdep_tex():
352351
try:
@@ -523,7 +522,11 @@ def _get_xdg_config_dir():
523522
base directory spec
524523
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
525524
"""
526-
return os.environ.get('XDG_CONFIG_HOME', os.path.join(get_home(), '.config'))
525+
home = get_home()
526+
if home is None:
527+
return None
528+
else:
529+
return os.environ.get('XDG_CONFIG_HOME', os.path.join(home, '.config'))
527530

528531

529532
def _get_xdg_cache_dir():
@@ -532,7 +535,11 @@ def _get_xdg_cache_dir():
532535
base directory spec
533536
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
534537
"""
535-
return os.environ.get('XDG_CACHE_HOME', os.path.join(get_home(), '.cache'))
538+
home = get_home()
539+
if home is None:
540+
return None
541+
else:
542+
return os.environ.get('XDG_CACHE_HOME', os.path.join(home, '.cache'))
536543

537544

538545
def _get_config_or_cache_dir(xdg_base):
@@ -548,22 +555,27 @@ def _get_config_or_cache_dir(xdg_base):
548555
return _create_tmp_config_dir()
549556
return configdir
550557

558+
p = None
551559
h = get_home()
552-
p = os.path.join(h, '.matplotlib')
553-
if (sys.platform.startswith('linux') and
554-
not os.path.exists(p)):
555-
p = os.path.join(xdg_base, 'matplotlib')
556-
557-
if os.path.exists(p):
558-
if not _is_writable_dir(p):
559-
return _create_tmp_config_dir()
560-
else:
561-
try:
562-
mkdirs(p)
563-
except OSError:
564-
return _create_tmp_config_dir()
560+
if h is not None:
561+
p = os.path.join(h, '.matplotlib')
562+
if (sys.platform.startswith('linux') and
563+
xdg_base is not None):
564+
p = os.path.join(xdg_base, 'matplotlib')
565+
566+
if p is not None:
567+
if os.path.exists(p):
568+
if _is_writable_dir(p):
569+
return p
570+
else:
571+
try:
572+
mkdirs(p)
573+
except OSError:
574+
pass
575+
else:
576+
return p
565577

566-
return p
578+
return _create_tmp_config_dir()
567579

568580

569581
def _get_configdir():
@@ -719,9 +731,11 @@ def matplotlib_fname():
719731
if configdir is not None:
720732
fname = os.path.join(configdir, 'matplotlibrc')
721733
if os.path.exists(fname):
734+
home = get_home()
722735
if (sys.platform.startswith('linux') and
723-
fname == os.path.join(
724-
get_home(), '.matplotlib', 'matplotlibrc')):
736+
home is not None and
737+
os.path.exists(os.path.join(
738+
home, '.matplotlib', 'matplotlibrc'))):
725739
warnings.warn(
726740
"Found matplotlib configuration in ~/.matplotlib/. "
727741
"To conform with the XDG base directory standard, "
@@ -730,6 +744,8 @@ def matplotlib_fname():
730744
"Please move your configuration there to ensure that "
731745
"matplotlib will continue to find it in the future." %
732746
_get_xdg_config_dir())
747+
return os.path.join(
748+
home, '.matplotlib', 'matplotlibrc')
733749
return fname
734750

735751
path = get_data_path() # guaranteed to exist or raise

‎lib/matplotlib/artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/artist.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import re
77
import warnings
8+
import inspect
89
import matplotlib
910
import matplotlib.cbook as cbook
1011
from matplotlib import docstring, rcParams
@@ -952,6 +953,8 @@ def _get_setters_and_targets(self):
952953
o = getattr(self.o, name)
953954
if not six.callable(o):
954955
continue
956+
if len(inspect.getargspec(o)[0]) < 2:
957+
continue
955958
func = o
956959
if self.is_alias(func):
957960
continue

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2960,7 +2960,7 @@ def computeConfInterval(data, med, iq, bootstrap):
29602960
raise ValueError(msg1)
29612961
elif conf_intervals.shape[0] != col:
29622962
raise ValueError(msg2)
2963-
elif conf_intervals.shape[1] == 2:
2963+
elif conf_intervals.shape[1] != 2:
29642964
raise ValueError(msg3)
29652965
else:
29662966
if len(conf_intervals) != col:

‎lib/matplotlib/backends/backend_pdf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pdf.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,11 +2145,12 @@ def clip_cmd(self, cliprect, clippath):
21452145
"""Set clip rectangle. Calls self.pop() and self.push()."""
21462146
cmds = []
21472147
# Pop graphics state until we hit the right one or the stack is empty
2148-
while (self._cliprect, self._clippath) != (cliprect, clippath) \
2149-
and self.parent is not None:
2148+
while ((self._cliprect, self._clippath) != (cliprect, clippath)
2149+
and self.parent is not None):
21502150
cmds.extend(self.pop())
21512151
# Unless we hit the right one, set the clip polygon
2152-
if (self._cliprect, self._clippath) != (cliprect, clippath):
2152+
if ((self._cliprect, self._clippath) != (cliprect, clippath) or
2153+
self.parent is None):
21532154
cmds.extend(self.push())
21542155
if self._cliprect != cliprect:
21552156
cmds.extend([cliprect, Op.rectangle, Op.clip, Op.endpath])

‎lib/matplotlib/backends/backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_ps.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def _fn_name(): return sys._getframe(1).f_code.co_name
1717
from md5 import md5 #Deprecated in 2.5
1818

1919
from tempfile import mkstemp
20-
from matplotlib import verbose, __version__, rcParams
20+
from matplotlib import verbose, __version__, rcParams, checkdep_ghostscript
2121
from matplotlib._pylab_helpers import Gcf
2222
from matplotlib.afm import AFM
2323
from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
@@ -70,8 +70,9 @@ def gs_exe(self):
7070
except KeyError:
7171
pass
7272

73-
if sys.platform == 'win32': gs_exe = 'gswin32c'
74-
else: gs_exe = 'gs'
73+
gs_exe, gs_version = checkdep_ghostscript()
74+
if gs_exe is None:
75+
gs_exe = 'gs'
7576

7677
self._cached["gs_exe"] = gs_exe
7778
return gs_exe
@@ -1613,8 +1614,7 @@ def get_bbox(tmpfile, bbox):
16131614
"""
16141615

16151616
outfile = tmpfile + '.output'
1616-
if sys.platform == 'win32': gs_exe = 'gswin32c'
1617-
else: gs_exe = 'gs'
1617+
gs_exe = ps_backend_helper.gs_exe
16181618
command = '%s -dBATCH -dNOPAUSE -sDEVICE=bbox "%s"' %\
16191619
(gs_exe, tmpfile)
16201620
verbose.report(command, 'debug')

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,15 +1336,15 @@ def findfont(prop, fontext='ttf'):
13361336
return result
13371337

13381338
else:
1339+
_fmcache = None
1340+
13391341
if not 'TRAVIS' in os.environ:
13401342
cachedir = get_cachedir()
13411343
if cachedir is not None:
13421344
if six.PY3:
13431345
_fmcache = os.path.join(cachedir, 'fontList.py3k.cache')
13441346
else:
13451347
_fmcache = os.path.join(cachedir, 'fontList.cache')
1346-
else:
1347-
_fmcache = None
13481348

13491349
fontManager = None
13501350

‎lib/matplotlib/tests/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/__init__.py
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,24 @@
44
import six
55

66
import difflib
7+
import os
78

89
from matplotlib import rcParams, rcdefaults, use
910

1011

1112
_multiprocess_can_split_ = True
1213

1314

15+
# Check that the test directories exist
16+
if not os.path.exists(os.path.join(
17+
os.path.dirname(__file__), 'baseline_images')):
18+
raise IOError(
19+
'The baseline image directory does not exist. '
20+
'This is most likely because the test data is not installed. '
21+
'You may need to install matplotlib from source to get the '
22+
'test data.')
23+
24+
1425
def setup():
1526
# The baseline images are created in this locale, so we should use
1627
# it during all of the tests.
Loading

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,21 @@ def test_boxplot():
10451045
conf_intervals=[None, (-1.0, 3.5)], notch=1)
10461046
ax.set_ylim((-30, 30))
10471047

1048+
@image_comparison(baseline_images=['boxplot_with_CIarray'],
1049+
remove_text=True, extensions=['png'],
1050+
savefig_kwarg={'dpi': 40})
1051+
def test_boxplot_with_CIarray():
1052+
x = np.linspace(-7, 7, 140)
1053+
x = np.hstack([-25, x, 25])
1054+
fig = plt.figure()
1055+
ax = fig.add_subplot(111)
1056+
CIs = np.array([[-1.5, 3.], [-1., 3.5]])
1057+
1058+
# show 1 boxplot with mpl medians/conf. interfals, 1 with manual values
1059+
ax.boxplot([x, x], bootstrap=10000, usermedians=[None, 1.0],
1060+
conf_intervals=CIs, notch=1)
1061+
ax.set_ylim((-30, 30))
1062+
10481063
@image_comparison(baseline_images=['boxplot_no_inverted_whisker'],
10491064
remove_text=True, extensions=['png'],
10501065
savefig_kwarg={'dpi': 40})

‎lib/matplotlib/tri/_tri.cpp

Copy file name to clipboardExpand all lines: lib/matplotlib/tri/_tri.cpp
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,14 +2177,14 @@ TrapezoidMapTriFinder::Trapezoid::set_upper_right(Trapezoid* upper_right_)
21772177

21782178

21792179
RandomNumberGenerator::RandomNumberGenerator(unsigned long seed)
2180-
: _M(21870), _A(1291), _C(4621), _seed(seed % _M)
2180+
: _m(21870), _a(1291), _c(4621), _seed(seed % _m)
21812181
{}
21822182

21832183
unsigned long
21842184
RandomNumberGenerator::operator()(unsigned long max_value)
21852185
{
2186-
_seed = (_seed*_A + _C) % _M;
2187-
return (_seed*max_value) / _M;
2186+
_seed = (_seed*_a + _c) % _m;
2187+
return (_seed*max_value) / _m;
21882188
}
21892189

21902190

‎lib/matplotlib/tri/_tri.h

Copy file name to clipboardExpand all lines: lib/matplotlib/tri/_tri.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ class RandomNumberGenerator
818818
unsigned long operator()(unsigned long max_value);
819819

820820
private:
821-
const unsigned long _M, _A, _C;
821+
const unsigned long _m, _a, _c;
822822
unsigned long _seed;
823823
};
824824

‎setup.py

Copy file name to clipboardExpand all lines: setup.py
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
else:
4747
del sdist.sdist.make_release_tree
4848

49+
from distutils.dist import Distribution
50+
4951
import setupext
5052
from setupext import print_line, print_raw, print_message, print_status
5153

@@ -127,6 +129,7 @@
127129
package_data = {}
128130
package_dir = {'': 'lib'}
129131
install_requires = []
132+
setup_requires = []
130133
default_backend = None
131134

132135

@@ -189,6 +192,7 @@
189192
package_data.setdefault(key, [])
190193
package_data[key] = list(set(val + package_data[key]))
191194
install_requires.extend(package.get_install_requires())
195+
setup_requires.extend(package.get_setup_requires())
192196

193197
# Write the default matplotlibrc file
194198
if default_backend is None:
@@ -209,6 +213,13 @@
209213

210214
extra_args = {}
211215

216+
# Avoid installing setup_requires dependencies if the user just
217+
# queries for information
218+
if (any('--' + opt in sys.argv for opt in
219+
Distribution.display_option_names + ['help']) or
220+
'clean' in sys.argv):
221+
setup_requires = []
222+
212223
# Finally, pass this all along to distutils to do the heavy lifting.
213224
distrib = setup(
214225
name="matplotlib",
@@ -237,6 +248,7 @@
237248

238249
# List third-party Python packages that we require
239250
install_requires=install_requires,
251+
setup_requires=setup_requires,
240252

241253
# matplotlib has C/C++ extensions, so it's not zip safe.
242254
# Telling setuptools this prevents it from doing an automatic

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.