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

Skip to content

Remove __version__numpy__; simplify dependencies check. #11980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Matplotlib requires the following dependencies:
* `Python <https://www.python.org/downloads/>`_ (>= 3.5)
* `FreeType <https://www.freetype.org/>`_ (>= 2.3)
* `libpng <http://www.libpng.org>`_ (>= 1.2)
* `NumPy <http://www.numpy.org>`_ (>= |minimum_numpy_version|)
* `NumPy <http://www.numpy.org>`_ (>= 1.10.0)
* `setuptools <https://setuptools.readthedocs.io/en/latest/>`_
* `cycler <http://matplotlib.org/cycler/>`_ (>= 0.10.0)
* `dateutil <https://pypi.python.org/pypi/python-dateutil>`_ (>= 2.1)
Expand Down
6 changes: 6 additions & 0 deletions doc/api/next_api_changes/2018-08-31-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
API removals
````````````

The following API elements have been removed:

- ``__version__numpy__``
4 changes: 0 additions & 4 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,6 @@ def _check_deps():
# documentation
autoclass_content = 'both'

rst_epilog = """
.. |minimum_numpy_version| replace:: %s
""" % matplotlib.__version__numpy__

texinfo_documents = [
("contents", 'matplotlib', 'Matplotlib Documentation',
'John Hunter@*Darren Dale@*Eric Firing@*Michael Droettboom@*'
Expand Down
34 changes: 13 additions & 21 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@

_log = logging.getLogger(__name__)

__version__numpy__ = '1.10.0' # minimum required numpy version

__bibtex__ = r"""@Article{Hunter:2007,
Author = {Hunter, J. D.},
Title = {Matplotlib: A 2D graphics environment},
Expand Down Expand Up @@ -189,27 +187,21 @@ def compare_versions(a, b):
return False


try:
import dateutil
except ImportError:
raise ImportError("Matplotlib requires dateutil")


try:
import pyparsing
except ImportError:
raise ImportError("Matplotlib requires pyparsing")
else:
if not compare_versions(pyparsing.__version__, '2.0.1'):
raise ImportError(
"Matplotlib requires pyparsing>=2.0.1; you have %s"
% pyparsing.__version__)
def _check_versions():
for modname, minver in [
("cycler", "0.10"),
("dateutil", "2.1"),
("kiwisolver", "1.0.1"),
("numpy", "1.10"),
("pyparsing", "2.0.1"),
]:
module = importlib.import_module(modname)
if distutils.version.LooseVersion(module.__version__) < minver:
raise ImportError("Matplotlib requires {}>={}; you have {}"
.format(modname, minver, module.__version__))


if not compare_versions(numpy.__version__, __version__numpy__):
raise ImportError(
"Matplotlib requires numpy>=%s; you have %s" % (
__version__numpy__, numpy.__version__))
_check_versions()


if not hasattr(sys, 'argv'): # for modpython
Expand Down
26 changes: 0 additions & 26 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,6 @@ def _get_xdg_cache_dir():
options['local_freetype'] = lft or options.get('local_freetype', False)


def extract_versions():
"""
Extracts version values from the main matplotlib __init__.py and
returns them as a dictionary.
"""
with open('lib/matplotlib/__init__.py') as fd:
for line in fd.readlines():
if line.startswith('__version__numpy__'):
exec(line.strip())
return locals()


def has_include_file(include_dirs, filename):
"""
Returns `True` if *filename* can be found in one of the
Expand Down Expand Up @@ -855,20 +843,6 @@ def include_dirs_hook():

return [numpy.get_include()]

def check(self):
min_version = extract_versions()['__version__numpy__']
try:
import numpy
except ImportError:
return 'not found. pip may install it below.'

if not is_min_version(numpy.__version__, min_version):
raise SystemExit(
"Requires numpy %s or later to build. (Found %s)" %
(min_version, numpy.__version__))

return 'version %s' % numpy.__version__

def add_flags(self, ext):
# Ensure that PY_ARRAY_UNIQUE_SYMBOL is uniquely defined for
# each extension
Expand Down