Update to 3.0.0rc1.
This commit is contained in:
@@ -1,32 +1,39 @@
|
||||
From e318adb6b70cdb27eb8cd5235909b8e8430080d7 Mon Sep 17 00:00:00 2001
|
||||
From cdfa3680a45c623d8c36b39c229190436c5a6c17 Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Wed, 27 Sep 2017 19:35:59 -0400
|
||||
Subject: [PATCH 1/3] matplotlibrc path search fix
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
lib/matplotlib/__init__.py | 8 +++++---
|
||||
lib/matplotlib/__init__.py | 18 +++---------------
|
||||
lib/matplotlib/tests/test_rcparams.py | 22 ++++++++++++++++------
|
||||
2 files changed, 21 insertions(+), 9 deletions(-)
|
||||
2 files changed, 19 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py
|
||||
index c5accc3c3..bc38f316c 100644
|
||||
index 3f2a6a300..a2679c11c 100644
|
||||
--- a/lib/matplotlib/__init__.py
|
||||
+++ b/lib/matplotlib/__init__.py
|
||||
@@ -738,9 +738,12 @@ def _get_data_path():
|
||||
|
||||
_file = _decode_filesystem_path(__file__)
|
||||
path = os.sep.join([os.path.dirname(_file), 'mpl-data'])
|
||||
+ path = '/usr/share/matplotlib/mpl-data'
|
||||
if os.path.isdir(path):
|
||||
@@ -664,18 +664,7 @@ def _get_data_path():
|
||||
return path
|
||||
|
||||
+ raise RuntimeError('Could not find the matplotlib data files')
|
||||
+
|
||||
# setuptools' namespace_packages may highjack this init file
|
||||
# so need to try something known to be in matplotlib, not basemap
|
||||
import matplotlib.afm
|
||||
@@ -821,8 +824,7 @@ def matplotlib_fname():
|
||||
def get_candidate_paths():
|
||||
- yield Path(__file__).with_name('mpl-data')
|
||||
- # setuptools' namespace_packages may highjack this init file
|
||||
- # so need to try something known to be in Matplotlib, not basemap.
|
||||
- import matplotlib.afm
|
||||
- yield Path(matplotlib.afm.__file__).with_name('mpl-data')
|
||||
- # py2exe zips pure python, so still need special check.
|
||||
- if getattr(sys, 'frozen', None):
|
||||
- yield Path(sys.executable).with_name('mpl-data')
|
||||
- # Try again assuming we need to step up one more directory.
|
||||
- yield Path(sys.executable).parent.with_name('mpl-data')
|
||||
- # Try again assuming sys.path[0] is a dir not a exe.
|
||||
- yield Path(sys.path[0]) / 'mpl-data'
|
||||
+ yield Path('/usr/share/matplotlib/mpl-data')
|
||||
|
||||
for path in get_candidate_paths():
|
||||
if path.is_dir():
|
||||
@@ -727,8 +716,7 @@ def matplotlib_fname():
|
||||
|
||||
- `$HOME/.matplotlib/matplotlibrc` if `$HOME` is defined.
|
||||
|
||||
@@ -36,20 +43,20 @@ index c5accc3c3..bc38f316c 100644
|
||||
"""
|
||||
|
||||
def gen_candidates():
|
||||
@@ -835,7 +837,7 @@ def matplotlib_fname():
|
||||
@@ -741,7 +729,7 @@ def matplotlib_fname():
|
||||
yield matplotlibrc
|
||||
yield os.path.join(matplotlibrc, 'matplotlibrc')
|
||||
yield os.path.join(_get_configdir(), 'matplotlibrc')
|
||||
yield os.path.join(get_configdir(), 'matplotlibrc')
|
||||
- yield os.path.join(get_data_path(), 'matplotlibrc')
|
||||
+ yield '/etc/matplotlibrc'
|
||||
|
||||
for fname in gen_candidates():
|
||||
if os.path.exists(fname):
|
||||
diff --git a/lib/matplotlib/tests/test_rcparams.py b/lib/matplotlib/tests/test_rcparams.py
|
||||
index c0378e1bf..7f14bcc46 100644
|
||||
index 7eec4d421..4c74619f6 100644
|
||||
--- a/lib/matplotlib/tests/test_rcparams.py
|
||||
+++ b/lib/matplotlib/tests/test_rcparams.py
|
||||
@@ -424,14 +424,25 @@ def test_rcparams_reset_after_fail():
|
||||
@@ -451,11 +451,22 @@ def test_rcparams_reset_after_fail():
|
||||
assert mpl.rcParams['text.usetex'] is False
|
||||
|
||||
|
||||
@@ -67,18 +74,15 @@ index c0378e1bf..7f14bcc46 100644
|
||||
+
|
||||
+
|
||||
+def test_if_rctemplate_is_up_to_date(mplrc):
|
||||
# This tests if the matplotlibrc.template file
|
||||
# contains all valid rcParams.
|
||||
dep1 = mpl._all_deprecated
|
||||
dep2 = mpl._deprecated_set
|
||||
deprecated = list(dep1.union(dep2))
|
||||
# This tests if the matplotlibrc.template file contains all valid rcParams.
|
||||
deprecated = {*mpl._all_deprecated, *mpl._deprecated_remain_as_none}
|
||||
- path_to_rc = os.path.join(mpl.get_data_path(), 'matplotlibrc')
|
||||
- with open(path_to_rc, "r") as f:
|
||||
+ with open(mplrc, "r") as f:
|
||||
rclines = f.readlines()
|
||||
missing = {}
|
||||
for k, v in mpl.defaultParams.items():
|
||||
@@ -453,11 +464,10 @@ def test_if_rctemplate_is_up_to_date():
|
||||
@@ -478,11 +489,10 @@ def test_if_rctemplate_is_up_to_date():
|
||||
.format(missing.items()))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user