Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6cda361

Browse files
committed
Merge remote-tracking branch 'upstream/v1.2.x'
Conflicts: .travis.yml doc/users/whats_new.rst lib/matplotlib/__init__.py lib/matplotlib/backend_bases.py lib/matplotlib/tests/test_axes.py lib/matplotlib/tests/test_legend.py
2 parents 11e7ed9 + 1d6abc1 commit 6cda361

22 files changed

+1766
-42
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ install:
1717
- 'if [ $TRAVIS_PYTHON_VERSION == "3.2" ]; then pip install https://github.com/y-p/numpy/archive/1.6.2_with_travis_fix.tar.gz; fi'
1818
- 'if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then pip install numpy; fi' # should be nop if pre-installed
1919
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then pip install --use-mirrors PIL; fi
20+
- sudo apt-get install inkscape
2021
- python setup.py install
2122

2223
script:
23-
- mkdir ../foo
24-
- cd ../foo
24+
- mkdir ../tmp_test_dir
25+
- cd ../tmp_test_dir
2526
- python ../matplotlib/tests.py -sv

doc/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@
197197

198198
# Additional stuff for the LaTeX preamble.
199199
latex_preamble = """
200-
\usepackage{amsmath}
201-
\usepackage{amsfonts}
202-
\usepackage{amssymb}
203-
\usepackage{txfonts}
200+
\\usepackage{amsmath}
201+
\\usepackage{amsfonts}
202+
\\usepackage{amssymb}
203+
\\usepackage{txfonts}
204204
"""
205205

206206
# Documents to append as an appendix to all manuals.

doc/devel/testing.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,15 @@ it::
122122
The first time this test is run, there will be no baseline image to
123123
compare against, so the test will fail. Copy the output images (in
124124
this case `result_images/test_category/spines_axes_positions.*`) to
125-
the `baseline_images` tree in the source directory (in this case
126-
`lib/matplotlib/tests/baseline_images/test_category`) and put them
127-
under source code revision control (with `git add`). When rerunning
128-
the tests, they should now pass.
125+
the correct subdirectory of `baseline_images` tree in the source
126+
directory (in this case
127+
`lib/matplotlib/tests/baseline_images/test_category`). Note carefully
128+
the `.*` at the end: this will copy only the images we need to include
129+
in the `git` repository. The files ending in `_pdf.png` and
130+
`_svg.png` are converted from the `pdf` and `svg` originals on the fly
131+
and do not need to be in the respository. Put these new files under
132+
source code revision control (with `git add`). When rerunning the
133+
tests, they should now pass.
129134

130135
There are two optional keyword arguments to the `image_comparison`
131136
decorator:

doc/make.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,20 @@ def copytree(src, dst, symlinks=False, ignore=None):
8989
copy2(srcname, dstname)
9090
# catch the Error from the recursive copytree so that we can
9191
# continue with other files
92-
except Error, err:
92+
except Error as err:
9393
errors.extend(err.args[0])
94-
except EnvironmentError, why:
94+
except EnvironmentError as why:
9595
errors.append((srcname, dstname, str(why)))
9696
try:
9797
copystat(src, dst)
98-
except OSError, why:
98+
except OSError as why:
9999
if WindowsError is not None and isinstance(why, WindowsError):
100100
# Copying file access times may fail on Windows
101101
pass
102102
else:
103103
errors.extend((src, dst, str(why)))
104104
if errors:
105-
raise Error, errors
105+
raise Error(errors)
106106

107107
### End compatibility block for pre-v2.6 ###
108108

doc/sphinxext/gen_gallery.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,18 @@ def gen_gallery(app, doctree):
121121

122122
gallery_path = os.path.join(app.builder.srcdir, '_templates', 'gallery.html')
123123
if os.path.exists(gallery_path):
124-
fh = file(gallery_path, 'r')
124+
fh = open(gallery_path, 'r')
125125
regenerate = fh.read() != content
126126
fh.close()
127127
else:
128128
regenerate = True
129129
if regenerate:
130-
fh = file(gallery_path, 'w')
130+
fh = open(gallery_path, 'w')
131131
fh.write(content)
132132
fh.close()
133133

134134
for key in app.builder.status_iterator(
135-
thumbnails.iterkeys(), "generating thumbnails... ",
135+
iter(thumbnails.keys()), "generating thumbnails... ",
136136
length=len(thumbnails)):
137137
image.thumbnail(key, thumbnails[key], 0.3)
138138

doc/sphinxext/gen_rst.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
generate the rst files for the examples by iterating over the pylab examples
33
"""
44
from __future__ import print_function
5+
import io
56
import os, glob
67

78
import os
@@ -37,15 +38,18 @@ def generate_example_rst(app):
3738
continue
3839

3940
fullpath = os.path.join(root,fname)
40-
contents = file(fullpath).read()
41+
if sys.version_info[0] >= 3:
42+
contents = io.open(fullpath, encoding='utf8').read()
43+
else:
44+
contents = io.open(fullpath).read()
4145
# indent
4246
relpath = os.path.split(root)[-1]
4347
datad.setdefault(relpath, []).append((fullpath, fname, contents))
4448

45-
subdirs = datad.keys()
49+
subdirs = list(datad.keys())
4650
subdirs.sort()
4751

48-
fhindex = file(os.path.join(exampledir, 'index.rst'), 'w')
52+
fhindex = open(os.path.join(exampledir, 'index.rst'), 'w')
4953
fhindex.write("""\
5054
.. _examples-index:
5155
@@ -77,7 +81,7 @@ def generate_example_rst(app):
7781
os.makedirs(outputdir)
7882

7983
subdirIndexFile = os.path.join(rstdir, 'index.rst')
80-
fhsubdirIndex = file(subdirIndexFile, 'w')
84+
fhsubdirIndex = open(subdirIndexFile, 'w')
8185
fhindex.write(' %s/index.rst\n\n'%subdir)
8286

8387
fhsubdirIndex.write("""\
@@ -122,14 +126,17 @@ def generate_example_rst(app):
122126
) and
123127
not noplot_regex.search(contents))
124128
if not do_plot:
125-
fhstatic = file(outputfile, 'w')
129+
fhstatic = open(outputfile, 'w')
126130
fhstatic.write(contents)
127131
fhstatic.close()
128132

129133
if not out_of_date(fullpath, outrstfile):
130134
continue
131135

132-
fh = file(outrstfile, 'w')
136+
if sys.version_info[0] >= 3:
137+
fh = io.open(outrstfile, 'w', encoding='utf8')
138+
else:
139+
fh = io.open(outrstfile, 'w')
133140
fh.write('.. _%s-%s:\n\n'%(subdir, basename))
134141
title = '%s example code: %s'%(subdir, fname)
135142
#title = '<img src=%s> %s example code: %s'%(thumbfile, subdir, fname)

0 commit comments

Comments
 (0)