Skip to content

Commit 098d198

Browse files
committed
Merge remote-tracking branch 'upstream/v1.1.x' into merge-v1.1.x
Conflicts: lib/matplotlib/__init__.py setupext.py
2 parents 396a644 + 2da9d8f commit 098d198

File tree

6 files changed

+35
-21
lines changed

6 files changed

+35
-21
lines changed

INSTALL

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ progress::
4545
>>> import numpy
4646
>>> print numpy.__version__
4747

48-
matplotlib requires numpy version 1.1 or later. Although it is not a
49-
requirement to use matplotlib, we strongly encourage you to install
50-
`ipython <http://ipython.org>`_, which is an interactive
51-
shell for python that is matplotlib-aware.
48+
matplotlib requires numpy version |minimum_numpy_version| or later.
49+
Although it is not a requirement to use matplotlib, we strongly
50+
encourage you to install `ipython <http://ipython.org>`_, which is an
51+
interactive shell for python that is matplotlib-aware.
5252

5353
Next, we need to get matplotlib installed. We provide prebuilt
5454
binaries for OS X and Windows on the matplotlib `download
@@ -182,7 +182,7 @@ libraries themselves.
182182
:term:`python` 2.6 (or later but not python3)
183183
matplotlib requires python 2.6 or later (`download <http://www.python.org/download/>`__)
184184

185-
:term:`numpy` 1.1 (or later)
185+
:term:`numpy` |minimum_numpy_version| (or later)
186186
array support for python (`download
187187
<http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103>`__)
188188

doc/conf.py

+4
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,7 @@
182182
# Show both class-level docstring and __init__ docstring in class
183183
# documentation
184184
autoclass_content = 'both'
185+
186+
rst_epilog = """
187+
.. |minimum_numpy_version| replace:: %s
188+
""" % matplotlib.__version__numpy__

lib/matplotlib/__init__.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
from __future__ import print_function
101101

102102
__version__ = '1.2.x'
103+
__version__numpy__ = '1.4' # minimum required numpy version
103104

104105
import os, re, shutil, subprocess, sys, warnings
105106
import distutils.sysconfig
@@ -161,11 +162,17 @@ def byte2str(b): return b
161162
if not _python24:
162163
raise ImportError('matplotlib requires Python 2.4 or later')
163164

165+
164166
import numpy
165-
nmajor, nminor = [int(n) for n in numpy.__version__.split('.')[:2]]
166-
if not (nmajor > 1 or (nmajor == 1 and nminor >= 1)):
167+
from distutils import version
168+
expected_version = version.StrictVersion(__version__numpy__)
169+
found_version = version.StrictVersion(numpy.__version__)
170+
if not found_version >= expected_version:
167171
raise ImportError(
168-
'numpy 1.1 or later is required; you have %s' % numpy.__version__)
172+
'numpy %s or later is required; you have %s' % (
173+
__version__numpy__, numpy.__version__))
174+
del version
175+
169176

170177
def is_string_like(obj):
171178
if hasattr(obj, 'shape'): return 0

lib/matplotlib/quiver.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,8 @@ def _make_verts(self, U, V):
576576
elif self.angles == 'uv':
577577
theta = np.angle(uv)
578578
else:
579-
theta = ma.masked_invalid(self.angles, copy=False).filled(0)
579+
# Make a copy to avoid changing the input array.
580+
theta = ma.masked_invalid(self.angles, copy=True).filled(0)
580581
theta = theta.ravel()
581582
theta *= (np.pi/180.0)
582583
theta.shape = (theta.shape[0], 1) # for broadcasting

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def chop_package(fname):
119119
baseline_images = [chop_package(f) for f in baseline_images]
120120
package_data['matplotlib'].extend(baseline_images)
121121

122-
if not check_for_numpy():
122+
if not check_for_numpy(__version__numpy__):
123123
sys.exit(1)
124124

125125
if not check_for_freetype():

setupext.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import os
4747
import re
4848
import subprocess
49-
from distutils import sysconfig
49+
from distutils import sysconfig, version
5050

5151
basedir = {
5252
'win32' : ['win32_static',],
@@ -549,21 +549,23 @@ def check_for_pdftops():
549549
print_status("pdftops", "no")
550550
return False
551551

552-
def check_for_numpy():
552+
def check_for_numpy(min_version):
553553
try:
554554
import numpy
555555
except ImportError:
556556
print_status("numpy", "no")
557-
print_message("You must install numpy 1.1 or later to build matplotlib.")
557+
print_message("You must install numpy %s or later to build matplotlib." %
558+
min_version)
558559
return False
559-
nn = numpy.__version__.split('.')
560-
if not (int(nn[0]) >= 1 and int(nn[1]) >= 1):
561-
if not (int(nn[0]) >= 2):
562-
print_message(
563-
'numpy 1.1 or later is required; you have %s' %
564-
numpy.__version__)
565-
return False
566-
module = make_extension('test', [])
560+
561+
expected_version = version.StrictVersion(min_version)
562+
found_version = version.StrictVersion(numpy.__version__)
563+
if not found_version >= expected_version:
564+
print_message(
565+
'numpy %s or later is required; you have %s' %
566+
(min_version, numpy.__version__))
567+
return False
568+
module = Extension('test', [])
567569
add_numpy_flags(module)
568570
add_base_flags(module)
569571

0 commit comments

Comments
 (0)