diff --git a/0001-Force-using-system-qhull.patch b/0001-Force-using-system-qhull.patch new file mode 100644 index 0000000000000000000000000000000000000000..d8079bc2c1921f60de06853398bbc6ed1a75d608 --- /dev/null +++ b/0001-Force-using-system-qhull.patch @@ -0,0 +1,43 @@ +From 46361ca058295e3f08d3c54196d990c497834306 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Fri, 30 Mar 2018 03:15:51 -0400 +Subject: [PATCH] Force using system qhull. + +Signed-off-by: Elliott Sales de Andrade +--- + setupext.py | 17 ++--------------- + 1 file changed, 2 insertions(+), 15 deletions(-) + +diff --git a/setupext.py b/setupext.py +index d2ff239ad..30e0c9085 100644 +--- a/setupext.py ++++ b/setupext.py +@@ -1318,23 +1318,10 @@ class Qhull(SetupPackage): + + def check(self): + self.__class__.found_external = True +- try: +- return self._check_for_pkg_config( +- 'libqhull', 'libqhull/qhull_a.h', min_version='2015.2') +- except CheckFailed as e: +- self.__class__.found_pkgconfig = False +- self.__class__.found_external = False +- return str(e) + ' Using local copy.' ++ return ' Using system copy.' + + def add_flags(self, ext): +- if self.found_external: +- pkg_config.setup_extension(ext, 'qhull', +- default_libraries=['qhull']) +- else: +- ext.include_dirs.insert(0, 'extern') +- ext.sources.extend(sorted(glob.glob('extern/libqhull/*.c'))) +- if sysconfig.get_config_var('LIBM') == '-lm': +- ext.libraries.extend('m') ++ ext.libraries.append('qhull') + + + class TTConv(SetupPackage): +-- +2.14.3 + diff --git a/0001-matplotlibrc-path-search-fix.patch b/0001-matplotlibrc-path-search-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..b9400b621b4c4fc2593973950480a2389da3f21c --- /dev/null +++ b/0001-matplotlibrc-path-search-fix.patch @@ -0,0 +1,97 @@ +From 84ebbed32cf1c0f4d56a6191ce7470fda6ea0543 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Wed, 27 Sep 2017 19:35:59 -0400 +Subject: [PATCH 1/3] matplotlibrc path search fix + +Signed-off-by: Elliott Sales de Andrade +--- + lib/matplotlib/__init__.py | 8 +++++--- + lib/matplotlib/tests/test_rcparams.py | 22 ++++++++++++++++------ + 2 files changed, 21 insertions(+), 9 deletions(-) + +diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py +index c5accc3c3..bc38f316c 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): + 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(): + + - `$HOME/.matplotlib/matplotlibrc` if `$HOME` is defined. + +- - Lastly, it looks in `$MATPLOTLIBDATA/matplotlibrc` for a +- system-defined copy. ++ - Lastly, it looks in `/etc/matplotlibrc` for a system-defined copy. + """ + + def gen_candidates(): +@@ -835,7 +837,7 @@ def matplotlib_fname(): + yield matplotlibrc + yield os.path.join(matplotlibrc, '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 +--- a/lib/matplotlib/tests/test_rcparams.py ++++ b/lib/matplotlib/tests/test_rcparams.py +@@ -424,14 +424,25 @@ def test_rcparams_reset_after_fail(): + assert mpl.rcParams['text.usetex'] is False + + +-def test_if_rctemplate_is_up_to_date(): ++@pytest.fixture ++def mplrc(): ++ # This is the Fedora-specific location ... ++ if 'MATPLOTLIBDATA' in os.environ: ++ # ... in buildroot. ++ return os.path.join(os.environ['MATPLOTLIBDATA'], ++ '../../../../etc/matplotlibrc') ++ else: ++ # ... on installed systems. ++ return '/etc/matplotlibrc' ++ ++ ++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)) +- 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(): + .format(missing.items())) + + +-def test_if_rctemplate_would_be_valid(tmpdir): ++def test_if_rctemplate_would_be_valid(tmpdir, mplrc): + # This tests if the matplotlibrc.template file would result in a valid + # rc file if all lines are uncommented. +- 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() + newlines = [] + for line in rclines: +-- +2.20.1 + diff --git a/python-matplotlib.spec b/python-matplotlib.spec index 1bd1ba73dc7bc50d44d2bea96476c3de64abba6a..2ba70c27d1af9d44a04e7018e42a15d774a9e64e 100644 --- a/python-matplotlib.spec +++ b/python-matplotlib.spec @@ -1,7 +1,7 @@ %global debug_package %{nil} Name: python-matplotlib Version: 2.2.4 -Release: 3 +Release: 4 Summary: A comprehensive library for creating static, animated, and interactive visualizations License: Python and MIT and OFL-1.1 and BSD-3-Clause URL: https://github.com/matplotlib/matplotlib @@ -10,6 +10,8 @@ Source0: https://github.com/matplotlib/matplotlib/archive/v%{version}/mat Source1: setup.cfg Source1000: https://github.com/QuLogic/mpl-images/archive/v2.2.3-with-freetype-2.8/matplotlib-2.2.3-with-freetype-2.9.1.tar.gz Patch0001: 0001-Use-packaged-jquery-and-jquery-ui.patch +Patch0002: 0001-matplotlibrc-path-search-fix.patch +Patch0003: 0001-Force-using-system-qhull.patch BuildRequires: freetype-devel libpng-devel qhull-devel texlive-cm xorg-x11-server-Xvfb zlib-devel @@ -99,6 +101,8 @@ Test data for python3-matplotlib. %prep %autosetup -n matplotlib-%{version} -p1 -N %patch0001 -p1 +%patch0002 -p1 +%patch0003 -p1 gzip -dc %SOURCE1000 | tar xvf - --transform='s~^mpl-images-2.2.3-with-freetype-2.9.1/\([^/]\+\)/~lib/\1/tests/baseline_images/~' rm -r extern/libqhull sed 's/\(backend = \).*/\1TkAgg/' >setup.cfg <%{SOURCE1} @@ -159,6 +163,9 @@ chmod +x %{buildroot}%{python3_sitearch}/matplotlib/dates.py %{python3_sitearch}/matplotlib/backends/{tkagg.*,__pycache__/tkagg.*,_tkagg.*} %changelog +* Wed Mar 10 2021 caodongxia - 2.2.4-4 +- Fix the function-import matplotlib and import matplotlib.pyplot + * Fri Feb 19 2021 liyanan - 2.2.4-3 - remove python2 dependency