8000 Merge branch 'v2.x' · matplotlib/matplotlib@a495675 · GitHub
[go: up one dir, main page]

Skip to content

Commit a495675

Browse files
committed
Merge branch 'v2.x'
2 parents 7ebf2fa + f00274f commit a495675

23 files changed

+107
-58
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ before_install:
8989
pip install --upgrade virtualenv
9090
python -m virtualenv venv
9191
source venv/bin/activate
92+
# test with non-ascii in path
93+
mkdir /tmp/λ
94+
export PATH=$PATH:/tmp/λ
9295
export PATH=/usr/lib/ccache:$PATH
9396
else
9497
brew update
@@ -138,8 +141,7 @@ install:
138141 9E88
fi;
139142
- |
140143
# Install matplotlib
141-
pip install -e .
142-
- |
144+
pip install -ve .
143145
144146
script:
145147
# The number of processes is hardcoded, because using too many causes the

doc/api/api_changes.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,20 @@ replaced by ``nipy_spectral`` and ``nipy_spectral_r`` since Matplotlib
201201
raised a warning. As of Matplotlib 2.0.0, using the old names raises a
202202
deprecation warning. In the future, using the old names will raise an error.
203203

204+
Default install no longer includes test images
205+
----------------------------------------------
206+
207+
To reduce the size of wheels and source installs, the tests and
208+
baseline images are no longer included by default.
209+
210+
To restore installing the tests and images, use a `setup.cfg` with ::
211+
212+
[packages]
213+
tests = True
214+
toolkits_tests = True
215+
216+
in the source directory at build/install time.
217+
204218
Changes in 1.5.3
205219
================
206220

doc/devel/contributing.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ the env ``MPLLOCALFREETYPE`` as::
7777

7878
export MPLLOCALFREETYPE=1
7979

80-
or copy :file:`setup.cfg.template` to :file:`setup.cfg` and edit to contain ::
80+
or copy :file:`setup.cfg.template` to :file:`setup.cfg` and edit it to contain ::
8181

8282
[test]
8383
local_freetype = True
@@ -107,9 +107,15 @@ Alternatively, if you do ::
107107

108108
all of the files will be copied to the installation directory however,
109109
you will have to rerun this command every time the source is changed.
110+
Additionally you will need to copy :file:`setup.cfg.template` to
111+
:file:`setup.cfg` and edit it to contain ::
110112

113+
[test]
114+
local_freetype = True
115+
tests = True
111116

112-
You can then run the tests to check your work environment is set up properly::
117+
In either case you can then run the tests to check your work
118+
environment is set up properly::
113119

114120
python tests.py
115121

doc/devel/testing.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ matplotlib source directory::
4545

4646
[test]
4747
local_freetype = True
48+
tests = True
4849

4950
or by setting the ``MPLLOCALFREETYPE`` environmental variable to any true
5051
value.

lib/matplotlib/__init__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ def ge(self, level):
359359

360360
def checkdep_dvipng():
361361
try:
362-
s = subprocess.Popen(['dvipng', '-version'], stdout=subprocess.PIPE,
362+
s = subprocess.Popen([str('dvipng'), '-version'],
363+
stdout=subprocess.PIPE,
363364
stderr=subprocess.PIPE)
364365
stdout, stderr = s.communicate()
365366
line = stdout.decode('ascii').split('\n')[1]
@@ -379,7 +380,7 @@ def checkdep_ghostscript():
379380
for gs_exec in gs_execs:
380381
try:
381382
s = subprocess.Popen(
382-
[gs_exec, '--version'], stdout=subprocess.PIPE,
383+
[str(gs_exec), '--version'], stdout=subprocess.PIPE,
383384
stderr=subprocess.PIPE)
384385
stdout, stderr = s.communicate()
385386
if s.returncode == 0:
@@ -395,7 +396,7 @@ def checkdep_ghostscript():
395396

396397
def checkdep_tex():
397398
try:
398-
s = subprocess.Popen(['tex', '-version'], stdout=subprocess.PIPE,
399+
s = subprocess.Popen([str('tex'), '-version'], stdout=subprocess.PIPE,
399400
stderr=subprocess.PIPE)
400401
stdout, stderr = s.communicate()
401402
line = stdout.decode('ascii').split('\n')[0]
@@ -409,7 +410,7 @@ def checkdep_tex():
409410

410411
def checkdep_pdftops():
411412
try:
412-
s = subprocess.Popen(['pdftops', '-v'], stdout=subprocess.PIPE,
413+
s = subprocess.Popen([str('pdftops'), '-v'], stdout=subprocess.PIPE,
413414
stderr=subprocess.PIPE)
414415
stdout, stderr = s.communicate()
415416
lines = stderr.decode('ascii').split('\n')
@@ -424,7 +425,8 @@ def checkdep_pdftops():
424425
def checkdep_inkscape():
425426
if checkdep_inkscape.version is None:
426427
try:
427-
s = subprocess.Popen(['inkscape', '-V'], stdout=subprocess.PIPE,
428+
s = subprocess.Popen([str('inkscape'), '-V'],
429+
stdout=subprocess.PIPE,
428430
stderr=subprocess.PIPE)
429431
stdout, stderr = s.communicate()
430432
lines = stdout.decode('ascii').split('\n')
@@ -442,7 +444,8 @@ def checkdep_inkscape():
442444
@cbook.deprecated("2.1")
443445
def checkdep_xmllint():
444446
try:
445-
s = subprocess.Popen(['xmllint', '--version'], stdout=subprocess.PIPE,
447+
s = subprocess.Popen([str('xmllint'), '--version'],
448+
stdout=subprocess.PIPE,
446449
stderr=subprocess.PIPE)
447450
stdout, stderr = s.communicate()
448451
lines = stderr.decode('ascii').split('\n')

lib/matplotlib/animation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def bin_path(cls):
372372
subclass. This is a class method so that the tool can be looked for
373373
before making a particular MovieWriter subclass available.
374374
'''
375-
return rcParams[cls.exec_key]
375+
return str(rcParams[cls.exec_key])
376376

377377
@classmethod
378378
def isAvailable(cls):

lib/matplotlib/backends/backend_pgf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
# assuming fontconfig is installed and the command 'fc-list' exists
4646
try:
4747
# list scalable (non-bitmap) fonts
48-
fc_list = check_output(['fc-list', ':outline,scalable', 'family'])
48+
fc_list = check_output([str('fc-list'), ':outline,scalable', 'family'])
4949
fc_list = fc_list.decode('utf8')
5050
system_fonts = [f.split(',')[0] for f in fc_list.splitlines()]
5151
system_fonts = list(set(system_fonts))
@@ -179,7 +179,7 @@ def make_pdf_to_png_converter():
179179
tools_available = []
180180
# check for pdftocairo
181181
try:
182-
check_output(["pdftocairo", "-v"], stderr=subprocess.STDOUT)
182+
check_output([str("pdftocairo"), "-v"], stderr=subprocess.STDOUT)
183183
tools_available.append("pdftocairo")
184184
except:
185185
pass
@@ -191,14 +191,14 @@ def make_pdf_to_png_converter():
191191
# pick converter
192192
if "pdftocairo" in tools_available:
193193
def cairo_convert(pdffile, pngfile, dpi):
194-
cmd = ["pdftocairo", "-singlefile", "-png",
194+
cmd = [str("pdftocairo"), "-singlefile", "-png",
195195
"-r %d" % dpi, pdffile, os.path.splitext(pngfile)[0]]
196196
# for some reason this doesn't work without shell
197-
check_output(" ".join(cmd), shell=True, stderr=subprocess.STDOUT)
197+
check_output(cmd, shell=True, stderr=subprocess.STDOUT)
198198
return cairo_convert
199199
elif "gs" in tools_available:
200200
def gs_convert(pdffile, pngfile, dpi):
201-
cmd = [gs, '-dQUIET', '-dSAFER', '-dBATCH', '-dNOPAUSE', '-dNOPROMPT',
201+
cmd = [str(gs), '-dQUIET', '-dSAFER', '-dBATCH', '-dNOPAUSE', '-dNOPROMPT',
202202
'-sDEVICE=png16m', '-dUseCIEColor', '-dTextAlphaBits=4',
203203
'-dGraphicsAlphaBits=4', '-dDOINTERPOLATE', '-sOutputFile=%s' % pngfile,
204204
'-r%d' % dpi, pdffile]
@@ -300,7 +300,7 @@ def __init__(self):
300300
self.latex_header = LatexManager._build_latex_header()
301301
latex_end = "\n\\makeatletter\n\\@@end\n"
302302
try:
303-
latex = subprocess.Popen([self.texcommand, "-halt-on-error"],
303+
latex = subprocess.Popen([str(self.texcommand), "-halt-on-error"],
304304
stdin=subprocess.PIPE,
305305
stdout=subprocess.PIPE,
306306
cwd=self.tmpdir)
@@ -318,7 +318,7 @@ def __init__(self):
318318
raise LatexError("LaTeX returned an error, probably missing font or error in preamble:\n%s" % stdout)
319319

320320
# open LaTeX process for real work
321-
latex = subprocess.Popen([self.texcommand, "-halt-on-error"],
321+
latex = subprocess.Popen([str(self.texcommand), "-halt-on-error"],
322322
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
323323
cwd=self.tmpdir)
324324
self.latex = latex
@@ -899,7 +899,7 @@ def _print_pdf_to_fh(self, fh, *args, **kwargs):
899899
fh_tex.write(latexcode)
900900

901901
texcommand = get_texcommand()
902-
cmdargs = [texcommand, "-interaction=nonstopmode",
902+
cmdargs = [str(texcommand), "-interaction=nonstopmode",
903903
"-halt-on-error", "figure.tex"]
904904
try:
905905
check_output(cmdargs, stderr=subprocess.STDOUT, cwd=tmpdir)

lib/matplotlib/cbook.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ def report_memory(i=0): # argument may go away
14671467
pid = os.getpid()
14681468
if sys.platform == 'sunos5':
14691469
try:
1470-
a2 = Popen('ps -p %d -o osz' % pid, shell=True,
1470+
a2 = Popen(str('ps -p %d -o osz') % pid, shell=True,
14711471
stdout=PIPE).stdout.readlines()
14721472
except OSError:
14731473
raise NotImplementedError(
@@ -1476,7 +1476,7 @@ def report_memory(i=0): # argument may go away
14761476
mem = int(a2[-1].strip())
14771477
elif sys.platform.startswith('linux'):
14781478
try:
1479-
a2 = Popen('ps -p %d -o rss,sz' % pid, shell=True,
1479+
a2 = Popen(str('ps -p %d -o rss,sz') % pid, shell=True,
14801480
stdout=PIPE).stdout.readlines()
14811481
except OSError:
14821482
raise NotImplementedError(
@@ -1485,7 +1485,7 @@ def report_memory(i=0): # argument may go away
14851485
mem = int(a2[1].split()[1])
14861486
elif sys.platform.startswith('darwin'):
14871487
try:
1488-
a2 = Popen('ps -p %d -o rss,vsz' % pid, shell=True,
1488+
a2 = Popen(str('ps -p %d -o rss,vsz') % pid, shell=True,
14891489
stdout=PIPE).stdout.readlines()
14901490
except OSError:
14911491
raise NotImplementedError(
@@ -1494,7 +1494,7 @@ def report_memory(i=0): # argument may go away
14941494
mem = int(a2[1].split()[0])
14951495
elif sys.platform.startswith('win'):
14961496
try:
1497-
a2 = Popen(["tasklist", "/nh", "/fi", "pid eq %d" % pid],
1497+
a2 = Popen([str("tasklist"), "/nh", "/fi", "pid eq %d" % pid],
14981498
stdout=PIPE).stdout.read()
14991499
except OSError:
15001500
raise NotImplementedError(

lib/matplotlib/collections.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ def update_from(self, other):
771771
self._facecolors = other._facecolors
772772
self._linewidths = other._linewidths
773773
self._linestyles = other._linestyles
774+
self._us_linestyles = other._us_linestyles
774775
self._pickradius = other._pickradius
775776
self._hatch = other._hatch
776777

lib/matplotlib/dviread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ def find_tex_file(filename, format=None):
970970
The library that :program:`kpsewhich` is part of.
971971
"""
972972

973-
cmd = ['kpsewhich']
973+
cmd = [str('kpsewhich')]
974974
if format is not None:
975975
cmd += ['--format=' + format]
976976
cmd += [filename]

lib/matplotlib/font_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def _call_fc_list():
281281
'This may take a moment.'))
282282
timer.start()
283283
try:
284-
out = subprocess.check_output(['fc-list', '--format=%{file}'])
284+
out = subprocess.check_output([str('fc-list'), '--format=%{file}'])
285285
except (OSError, subprocess.CalledProcessError):
286286
return []
287287
finally:

lib/matplotlib/legend_handler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,11 @@ def get_numpoints(self, legend):
268268

269269
def _default_update_prop(self, legend_handle, orig_handle):
270270
lw = orig_handle.get_linewidths()[0]
271-
dashes = orig_handle.get_dashes()[0]
271+
dashes = orig_handle._us_linestyles[0]
272272
color = orig_handle.get_colors()[0]
273273
legend_handle.set_color(color)
274+
legend_handle.set_linestyle(dashes)
274275
legend_handle.set_linewidth(lw)
275-
if dashes[0] is not None: # dashed line
276-
legend_handle.set_dashes(dashes[1])
277276

278277
def create_artists(self, legend, orig_handle,
279278
xdescent, ydescent, width, height, fontsize, trans):

lib/matplotlib/lines.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,9 @@ def update_from(self, other):
12741274
self._markeredgecolor = other._markeredgecolor
12751275
self._markeredgewidth = other._markeredgewidth
12761276
self._dashSeq = other._dashSeq
1277+
self._us_dashSeq = other._us_dashSeq
12771278
self._dashOffset = other._dashOffset
1279+
self._us_dashOffset = other._us_dashOffset
12781280
self._dashcapstyle = other._dashcapstyle
12791281
self._dashjoinstyle = other._dashjoinstyle
12801282
self._solidcapstyle = other._solidcapstyle

lib/matplotlib/patches.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ def update_from(self, other):
199199
self._facecolor = other._facecolor
200200
self._fill = other._fill
201201
self._hatch = other._hatch
202-
self._linewidth = other._linewidth
203-
# Use setters, getters where we need the extra work they do.
204-
self.set_linestyle(other._linestyle) # also sets dash properties
202+
# copy the unscaled dash pattern
203+
self._us_dashes = other._us_dashes
204+
self.set_linewidth(other._linewidth) # also sets dash properties
205205
self.set_transform(other.get_data_transform())
206206

207207
def get_extents(self):

lib/matplotlib/rcsetup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,10 +1139,10 @@ def validate_animation_writer_path(p):
11391139
'date.autoformatter.year': ['%Y', six.text_type],
11401140
'date.autoformatter.month': ['%Y-%m', six.text_type],
11411141
'date.autoformatter.day': ['%Y-%m-%d', six.text_type],
1142-
'date.autoformatter.hour': ['%H:%M', six.text_type],
1143-
'date.autoformatter.minute': ['%H:%M:%S', six.text_type],
1142+
'date.autoformatter.hour': ['%m-%d %H', six.text_type],
1143+
'date.autoformatter.minute': ['%d %H:%M', six.text_type],
11441144
'date.autoformatter.second': ['%H:%M:%S', six.text_type],
1145-
'date.autoformatter.microsecond': ['%H:%M:%S.%f', six.text_type],
1145+
'date.autoformatter.microsecond': ['%M:%S.%f', six.text_type],
11461146

11471147
#legend properties
11481148
'legend.fancybox': [True, validate_bool],

lib/matplotlib/sphinxext/tests/test_tinypages.py

-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def setup_class(cls):
4242
cls.html_dir = pjoin(cls.page_build, 'html')
4343
cls.doctree_dir = pjoin(cls.page_build, 'doctrees')
4444
# Build the pages with warnings turned into errors
45-
cmd = ['sphinx-build', '-W', '-b', 'html',
45+
cmd = [str('sphinx-build'), '-W', '-b', 'html',
4646
'-d', cls.doctree_dir,
4747
TINY_PAGES,
4848
cls.html_dir]

lib/matplotlib/testing/compare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ def _update_converter():
132132
gs, gs_v = matplotlib.checkdep_ghostscript()
133133
if gs_v is not None:
134134
def cmd(old, new):
135-
return [gs, '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
135+
return [str(gs), '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
136136
'-sOutputFile=' + new, old]
137137
converter['pdf'] = make_external_conversion_command(cmd)
138138
converter['eps'] = make_external_conversion_command(cmd)
139139

140140
if matplotlib.checkdep_inkscape() is not None:
141141
def cmd(old, new):
142-
return ['inkscape', '-z', old, '--export-png', new]
142+
return [str('inkscape'), '-z', old, '--export-png', new]
143143
converter['svg'] = make_external_conversion_command(cmd)
144144

145145

lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def check_for(texsystem):
2828
\\@@end
2929
"""
3030
try:
31-
latex = subprocess.Popen([texsystem, "-halt-on-error"],
31+
latex = subprocess.Popen([str(texsystem), "-halt-on-error"],
3232
stdin=subprocess.PIPE,
3333
stdout=subprocess.PIPE)
3434
stdout, stderr = latex.communicate(header.encode("utf8"))

lib/matplotlib/tests/test_coding_standards.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ def test_pep8_conformance_installed_files():
206206
'tests/test_axes.py',
207207
'tests/test_bbox_tight.py',
208208
'tests/test_image.py',
209-
'tests/test_legend.py',
210209
'tests/test_lines.py',
211210
'tests/test_mathtext.py',
212211
'tests/test_rcparams.py',

0 commit comments

Comments
 (0)
0