Skip to content

Commit 05929fe

Browse files
committed
Merge pull request matplotlib#565 from mdboom/py3-merge
The MEGA Python 3.x branch merge
2 parents c37e89b + 08fbcdc commit 05929fe

File tree

281 files changed

+8455
-3517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+8455
-3517
lines changed

INSTALL

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ Next, we need to get matplotlib installed. We provide prebuilt
5454
binaries for OS X and Windows on the matplotlib `download
5555
<http://sourceforge.net/projects/matplotlib/files/>`_ page. Click on
5656
the latest release of the "matplotlib" package, choose your python
57-
version (e.g., 2.6 or 2.7) and your platform (macosx or win32).
58-
If you have any problems, please check the :ref:`installing-faq`,
59-
search using Google, and/or post a question to the `mailing list
57+
version (2.6, 2.7 or 3.2) and your platform (macosx or win32). If you
58+
have any problems, please check the :ref:`installing-faq`, search
59+
using Google, and/or post a question the `mailing list
6060
<http://sourceforge.net/project/showfiles.php?group_id=80706>`_.
6161

62-
If you are on Debian/Ubuntu Linux, it suffices to do::
62+
If you are on Debian/Ubuntu linux, it suffices to do::
6363

6464
> sudo apt-get install python-matplotlib
6565

doc/devel/coding_guide.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,7 @@ Requirements
365365

366366
The following software is required to run the tests:
367367

368-
- nose_, version 0.11.1 or later
369-
370-
- `Python Imaging Library
371-
<http://www.pythonware.com/products/pil/>`_ (to compare image
372-
results)
368+
- nose_, version 1.0 or later
373369

374370
- `Ghostscript <http://pages.cs.wisc.edu/~ghost/>`_ (to render PDF
375371
files)
@@ -405,6 +401,9 @@ arguments works from within Python::
405401
.. _`nosetest arguments`: http://somethingaboutorange.com/mrl/projects/nose/1.0.0/usage.html
406402

407403

404+
Running tests by any means other than `matplotlib.test()`
405+
does not load the nose "knownfailureif" (Known failing tests) plugin,
406+
causing known-failing tests to fail for real.
408407

409408
Writing a simple test
410409
---------------------

doc/make.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env python
2+
3+
from __future__ import print_function
24
import fileinput
35
import glob
46
import os
@@ -169,7 +171,7 @@ def latex():
169171

170172
os.chdir('../..')
171173
else:
172-
print 'latex build has not been tested on windows'
174+
print('latex build has not been tested on windows')
173175

174176
def clean():
175177
shutil.rmtree("build", ignore_errors=True)

doc/pyplots/make.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env python
2+
3+
from __future__ import print_function
4+
import sys, os, glob
5+
import matplotlib
6+
import IPython.Shell
7+
#matplotlib.rcdefaults()
8+
matplotlib.use('Agg')
9+
10+
mplshell = IPython.Shell.MatplotlibShell('mpl')
11+
12+
formats = [('png', 100),
13+
('hires.png', 200),
14+
('pdf', 72)]
15+
16+
def figs():
17+
print('making figs')
18+
import matplotlib.pyplot as plt
19+
for fname in glob.glob('*.py'):
20+
if fname.split('/')[-1] == __file__.split('/')[-1]: continue
21+
basename, ext = os.path.splitext(fname)
22+
imagefiles = dict([('%s.%s'%(basename, format), dpi)
23+
for format, dpi in formats])
24+
all_exists = True
25+
for imagefile in imagefiles:
26+
if not os.path.exists(imagefile):
27+
all_exists = False
28+
break
29+
30+
if all_exists:
31+
print(' already have %s'%fname)
32+
else:
33+
print(' building %s'%fname)
34+
plt.close('all') # we need to clear between runs
35+
mplshell.magic_run(basename)
36+
for imagefile, dpi in imagefiles.iteritems():
37+
# todo: this will get called even if the run script
38+
# fails and exits, thus creating a stub pdf and png
39+
# iles preventing them from getting built successfully
40+
# later
41+
plt.savefig(imagefile, dpi=dpi)
42+
print('all figures made')
43+
44+
45+
def clean():
46+
patterns = (['#*', '*~', '*pyc'] +
47+
['*.%s' % format for format, dpi in formats])
48+
for pattern in patterns:
49+
for fname in glob.glob(pattern):
50+
os.remove(fname)
51+
print('all clean')
52+
53+
54+
55+
def all():
56+
figs()
57+
58+
funcd = {'figs':figs,
59+
'clean':clean,
60+
'all':all,
61+
}
62+
63+
if len(sys.argv)>1:
64+
for arg in sys.argv[1:]:
65+
func = funcd.get(arg)
66+
if func is None:
67+
raise SystemExit('Do not know how to handle %s; valid args are'%(
68+
arg, funcd.keys()))
69+
func()
70+
else:
71+
all()
72+
73+
74+
75+

doc/sphinxext/gen_rst.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
generate the rst files for the examples by iterating over the pylab examples
33
"""
4+
from __future__ import print_function
45
import os, glob
56

67
import os
@@ -152,7 +153,7 @@ def generate_example_rst(app):
152153

153154
fhindex.close()
154155

155-
print
156+
print()
156157

157158
def setup(app):
158159
app.connect('builder-inited', generate_example_rst)

doc/sphinxext/math_symbol_table.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import print_function
12
symbols = [
23
["Lower-case Greek",
34
5,
@@ -141,7 +142,7 @@ def setup(app):
141142
# Do some verification of the tables
142143
from matplotlib import _mathtext_data
143144

144-
print "SYMBOLS NOT IN STIX:"
145+
print("SYMBOLS NOT IN STIX:")
145146
all_symbols = {}
146147
for category, columns, syms in symbols:
147148
if category == "Standard Function Names":
@@ -151,9 +152,9 @@ def setup(app):
151152
if len(sym) > 1:
152153
all_symbols[sym[1:]] = None
153154
if sym[1:] not in _mathtext_data.tex2uni:
154-
print sym
155+
print(sym)
155156

156-
print "SYMBOLS NOT IN TABLE:"
157+
print("SYMBOLS NOT IN TABLE:")
157158
for sym in _mathtext_data.tex2uni:
158159
if sym not in all_symbols:
159-
print sym
160+
print(sym)

doc/utils/pylab_names.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import print_function
12
"""
23
autogenerate some tables for pylab namespace
34
"""
@@ -14,7 +15,7 @@
1415
doc = getattr(o, '__doc__', None)
1516
if doc is not None:
1617
doc = ' - '.join([line for line in doc.split('\n') if line.strip()][:2])
17-
18+
1819
mod = getattr(o, '__module__', None)
1920
if mod is None:
2021
mod = 'unknown'
@@ -25,7 +26,7 @@
2526
k = ':class:`~%s.%s`'%(mod, k)
2627
else:
2728
k = ':func:`~%s.%s`'%(mod, k)
28-
mod = ':mod:`%s`'%mod
29+
mod = ':mod:`%s`'%mod
2930
elif mod.startswith('numpy'):
3031
#k = '`%s <%s>`_'%(k, 'http://scipy.org/Numpy_Example_List_With_Doc#%s'%k)
3132
k = '`%s <%s>`_'%(k, 'http://sd-2116.dedibox.fr/pydocweb/doc/%s.%s'%(mod, k))
@@ -40,21 +41,21 @@
4041
mods.sort()
4142
for mod in mods:
4243
border = '*'*len(mod)
43-
print mod
44-
print border
44+
print(mod)
45+
print(border)
4546

46-
print
47+
print()
4748
funcs, docs = zip(*modd[mod])
4849
maxfunc = max([len(f) for f in funcs])
4950
maxdoc = max(40, max([len(d) for d in docs]) )
5051
border = ' '.join(['='*maxfunc, '='*maxdoc])
51-
print border
52-
print ' '.join(['symbol'.ljust(maxfunc), 'description'.ljust(maxdoc)])
53-
print border
52+
print(border)
53+
print(' '.join(['symbol'.ljust(maxfunc), 'description'.ljust(maxdoc)]))
54+
print(border)
5455
for func, doc in modd[mod]:
5556
row = ' '.join([func.ljust(maxfunc), doc.ljust(maxfunc)])
56-
print row
57+
print(row)
5758

58-
print border
59-
print
59+
print(border)
60+
print()
6061
#break

examples/animation/old_animation/animate_decay_tk_blit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import print_function
12
import time, sys
23
import numpy as np
34
import matplotlib.pyplot as plt
@@ -44,7 +45,7 @@ def run(*args):
4445

4546
if run.cnt==1000:
4647
# print the timing info and quit
47-
print 'FPS:' , 1000/(time.time()-tstart)
48+
print('FPS:' , 1000/(time.time()-tstart))
4849
sys.exit()
4950

5051
run.cnt += 1

examples/animation/old_animation/animation_blit_fltk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import print_function
12
import sys
23
import fltk
34
import matplotlib
@@ -37,7 +38,7 @@ def update(self,ptr):
3738
self.cnt+=1
3839
if self.cnt==1000:
3940
# print the timing info and quit
40-
print 'FPS:' , 1000/(time.time()-self.tstart)
41+
print('FPS:' , 1000/(time.time()-self.tstart))
4142
sys.exit()
4243
return True
4344

examples/animation/old_animation/animation_blit_gtk.py

100644100755
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
4+
35
# For detailed comments on animation and the techniques used here, see
46
# the wiki entry
57
# http://www.scipy.org/wikis/topical_software/MatplotlibAnimation
@@ -30,7 +32,7 @@
3032
tstart = time.time()
3133

3234
def update_line(*args):
33-
print 'you are here', update_line.cnt
35+
print('you are here', update_line.cnt)
3436
if update_line.background is None:
3537
update_line.background = canvas.copy_from_bbox(ax.bbox)
3638

@@ -46,7 +48,7 @@ def update_line(*args):
4648

4749
if update_line.cnt==1000:
4850
# print the timing info and quit
49-
print 'FPS:' , 1000/(time.time()-tstart)
51+
print('FPS:' , 1000/(time.time()-tstart))
5052
gtk.mainquit()
5153
raise SystemExit
5254

0 commit comments

Comments
 (0)