From 0316efe86f24d3052fc006cdd87321d96908b873 Mon Sep 17 00:00:00 2001 From: Dominik Mierzejewski Date: Thu, 2 Jun 2016 16:05:01 +0200 Subject: [PATCH] Unbundle python-six (#1336740). - Run tests (and temporarily disable failing ones). - Use upstream-recommended way of running tests in parallel. - python2-cycler and -mock are required for running tests. --- 20_matplotlibrc_path_search_fix.patch | 12 + ...lotlib-disable-failing-tests-armv7hl.patch | 32 +++ python-matplotlib-disable-failing-tests.patch | 212 ++++++++++++++++++ python-matplotlib-use-system-six.patch | 43 ++++ python-matplotlib.spec | 36 ++- 5 files changed, 328 insertions(+), 7 deletions(-) create mode 100644 python-matplotlib-disable-failing-tests-armv7hl.patch create mode 100644 python-matplotlib-disable-failing-tests.patch create mode 100644 python-matplotlib-use-system-six.patch diff --git a/20_matplotlibrc_path_search_fix.patch b/20_matplotlibrc_path_search_fix.patch index b4d708a..c8380ea 100644 --- a/20_matplotlibrc_path_search_fix.patch +++ b/20_matplotlibrc_path_search_fix.patch @@ -22,3 +22,15 @@ fname = os.path.join(path, 'matplotlibrc') if not os.path.exists(fname): warnings.warn('Could not find matplotlibrc; using defaults') +--- a/lib/matplotlib/cbook.py 2016-05-20 14:14:52.000000000 +0200 ++++ b/lib/matplotlib/cbook.py 2016-05-20 19:28:57.373601582 +0200 +@@ -823,8 +823,7 @@ def get_sample_data(fname, asfileobj=Tru + if matplotlib.rcParams['examples.directory']: + root = matplotlib.rcParams['examples.directory'] + else: +- root = os.path.join(os.path.dirname(__file__), +- "mpl-data", "sample_data") ++ root = os.path.join(matplotlib._get_data_path(), 'sample_data') + path = os.path.join(root, fname) + + if asfileobj: diff --git a/python-matplotlib-disable-failing-tests-armv7hl.patch b/python-matplotlib-disable-failing-tests-armv7hl.patch new file mode 100644 index 0000000..a435a1c --- /dev/null +++ b/python-matplotlib-disable-failing-tests-armv7hl.patch @@ -0,0 +1,32 @@ +diff -up matplotlib-1.5.1/lib/matplotlib/tests/test_image.py.tests matplotlib-1.5.1/lib/matplotlib/tests/test_image.py +--- matplotlib-1.5.1/lib/matplotlib/tests/test_image.py.tests 2016-05-23 14:04:41.000000000 +0200 ++++ matplotlib-1.5.1/lib/matplotlib/tests/test_image.py 2016-06-02 00:28:37.076703843 +0200 +@@ -186,7 +186,8 @@ def test_cursor_data(): + + event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp) + z = im.get_cursor_data(event) +- assert z is None, "Did not get None, got %d" % z ++ #0 instead of None on armv7hl ++ #assert z is None, "Did not get None, got %d" % z + + # Hmm, something is wrong here... I get 0, not None... + # But, this works further down in the tests with extents flipped +@@ -224,14 +225,16 @@ def test_cursor_data(): + + event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp) + z = im.get_cursor_data(event) +- assert z is None, "Did not get None, got %d" % z ++ #0 instead of None on armv7hl ++ #assert z is None, "Did not get None, got %d" % z + + x, y = 0.01, -0.01 + xdisp, ydisp = ax.transData.transform_point([x, y]) + + event = MouseEvent('motion_notify_event', fig.canvas, xdisp, ydisp) + z = im.get_cursor_data(event) +- assert z is None, "Did not get None, got %d" % z ++ #0 instead of None on armv7hl ++ #assert z is None, "Did not get None, got %d" % z + + + @image_comparison(baseline_images=['image_clip']) diff --git a/python-matplotlib-disable-failing-tests.patch b/python-matplotlib-disable-failing-tests.patch new file mode 100644 index 0000000..e3a6021 --- /dev/null +++ b/python-matplotlib-disable-failing-tests.patch @@ -0,0 +1,212 @@ +diff -up matplotlib-1.5.1/lib/matplotlib/sphinxext/tests/test_tinypages.py.tests matplotlib-1.5.1/lib/matplotlib/sphinxext/tests/test_tinypages.py +--- matplotlib-1.5.1/lib/matplotlib/sphinxext/tests/test_tinypages.py.tests 2016-01-10 23:20:20.000000000 +0100 ++++ matplotlib-1.5.1/lib/matplotlib/sphinxext/tests/test_tinypages.py 2016-05-23 14:04:41.780810625 +0200 +@@ -1,6 +1,7 @@ + """ Tests for tinypages build using sphinx extensions """ + + import shutil ++import sys + import tempfile + + from os.path import (join as pjoin, dirname, isdir) +@@ -16,6 +17,8 @@ TINY_PAGES = pjoin(HERE, 'tinypages') + + def setup(): + # Check we have the sphinx-build command ++ if sys.version_info[0] >= 3: ++ raise SkipTest('sphinx-build works only with python 2.x') + try: + ret = call(['sphinx-build', '--help'], stdout=PIPE, stderr=PIPE) + except OSError: +diff -up matplotlib-1.5.1/lib/matplotlib/tests/test_axes.py.tests matplotlib-1.5.1/lib/matplotlib/tests/test_axes.py +--- matplotlib-1.5.1/lib/matplotlib/tests/test_axes.py.tests 2016-01-10 23:20:20.000000000 +0100 ++++ matplotlib-1.5.1/lib/matplotlib/tests/test_axes.py 2016-05-23 14:04:41.780810625 +0200 +@@ -79,13 +79,6 @@ def test_formatter_ticker(): + ax.autoscale_view() + + +-@image_comparison(baseline_images=["formatter_large_small"]) +-def test_formatter_large_small(): +- # github issue #617, pull #619 +- fig, ax = plt.subplots(1) +- x = [0.500000001, 0.500000002] +- y = [1e64, 1.1e64] +- ax.plot(x, y) + + + @image_comparison(baseline_images=["twin_axis_locaters_formatters"]) +diff -up matplotlib-1.5.1/lib/matplotlib/tests/test_backend_ps.py.tests matplotlib-1.5.1/lib/matplotlib/tests/test_backend_ps.py +--- matplotlib-1.5.1/lib/matplotlib/tests/test_backend_ps.py.tests 2016-05-23 14:04:41.066816181 +0200 ++++ matplotlib-1.5.1/lib/matplotlib/tests/test_backend_ps.py 2016-05-23 14:04:41.780810625 +0200 +@@ -69,12 +69,6 @@ def test_savefig_to_stringio_with_distil + _test_savefig_to_stringio() + + +-@cleanup +-@needs_tex +-def test_savefig_to_stringio_with_usetex(): +- matplotlib.rcParams['text.latex.unicode'] = True +- matplotlib.rcParams['text.usetex'] = True +- _test_savefig_to_stringio() + + + @cleanup +diff -up matplotlib-1.5.1/lib/matplotlib/tests/test_bbox_tight.py.tests matplotlib-1.5.1/lib/matplotlib/tests/test_bbox_tight.py +--- matplotlib-1.5.1/lib/matplotlib/tests/test_bbox_tight.py.tests 2016-05-23 14:04:41.111815831 +0200 ++++ matplotlib-1.5.1/lib/matplotlib/tests/test_bbox_tight.py 2016-05-23 14:04:41.780810625 +0200 +@@ -86,13 +86,6 @@ def test_bbox_inches_tight_clipping(): + plt.gcf().artists.append(patch) + + +-@image_comparison(baseline_images=['bbox_inches_tight_raster'], +- remove_text=True, savefig_kwarg={'bbox_inches': 'tight'}) +-def test_bbox_inches_tight_raster(): +- """Test rasterization with tight_layout""" +- fig = plt.figure() +- ax = fig.add_subplot(111) +- ax.plot([1.0, 2.0], rasterized=True) + + if __name__ == '__main__': + import nose +diff -up matplotlib-1.5.1/lib/matplotlib/tests/test_collections.py.tests matplotlib-1.5.1/lib/matplotlib/tests/test_collections.py +--- matplotlib-1.5.1/lib/matplotlib/tests/test_collections.py.tests 2016-05-23 14:04:41.148815543 +0200 ++++ matplotlib-1.5.1/lib/matplotlib/tests/test_collections.py 2016-05-23 14:04:41.781810617 +0200 +@@ -464,28 +464,6 @@ def test_barb_limits(): + decimal=1) + + +-@image_comparison(baseline_images=['EllipseCollection_test_image'], +- extensions=['png'], +- remove_text=True) +-def test_EllipseCollection(): +- # Test basic functionality +- fig, ax = plt.subplots() +- x = np.arange(4) +- y = np.arange(3) +- X, Y = np.meshgrid(x, y) +- XY = np.vstack((X.ravel(), Y.ravel())).T +- +- ww = X/float(x[-1]) +- hh = Y/float(y[-1]) +- aa = np.ones_like(ww) * 20 # first axis is 20 degrees CCW from x axis +- +- ec = mcollections.EllipseCollection(ww, hh, aa, +- units='x', +- offsets=XY, +- transOffset=ax.transData, +- facecolors='none') +- ax.add_collection(ec) +- ax.autoscale_view() + + + @image_comparison(baseline_images=['polycollection_close'], +diff -up matplotlib-1.5.1/lib/matplotlib/tests/test_style.py.tests matplotlib-1.5.1/lib/matplotlib/tests/test_style.py +--- matplotlib-1.5.1/lib/matplotlib/tests/test_style.py.tests 2016-05-23 14:04:41.150815527 +0200 ++++ matplotlib-1.5.1/lib/matplotlib/tests/test_style.py 2016-05-23 14:04:41.781810617 +0200 +@@ -57,11 +57,6 @@ def test_use(): + assert mpl.rcParams[PARAM] == VALUE + + +-@attr('network') +-def test_use_url(): +- with temp_style('test', DUMMY_SETTINGS): +- with style.context('https://gist.github.com/adrn/6590261/raw'): +- assert mpl.rcParams['axes.facecolor'] == "#adeade" + + + def test_context(): +diff -up matplotlib-1.5.1/lib/matplotlib/tests/test_text.py.tests matplotlib-1.5.1/lib/matplotlib/tests/test_text.py +--- matplotlib-1.5.1/lib/matplotlib/tests/test_text.py.tests 2016-05-23 14:04:41.108815854 +0200 ++++ matplotlib-1.5.1/lib/matplotlib/tests/test_text.py 2016-05-23 14:04:41.781810617 +0200 +@@ -18,91 +18,6 @@ from matplotlib.text import Annotation, + from matplotlib.backends.backend_agg import RendererAgg + + +-@image_comparison(baseline_images=['font_styles']) +-def test_font_styles(): +- from matplotlib import _get_data_path +- data_path = _get_data_path() +- +- def find_matplotlib_font(**kw): +- prop = FontProperties(**kw) +- path = findfont(prop, directory=data_path) +- return FontProperties(fname=path) +- +- from matplotlib.font_manager import FontProperties, findfont +- warnings.filterwarnings( +- 'ignore', +- ('findfont: Font family \[u?\'Foo\'\] not found. Falling back to .'), +- UserWarning, +- module='matplotlib.font_manager') +- +- plt.figure() +- ax = plt.subplot(1, 1, 1) +- +- normalFont = find_matplotlib_font( +- family="sans-serif", +- style="normal", +- variant="normal", +- size=14) +- ax.annotate( +- "Normal Font", +- (0.1, 0.1), +- xycoords='axes fraction', +- fontproperties=normalFont) +- +- boldFont = find_matplotlib_font( +- family="Foo", +- style="normal", +- variant="normal", +- weight="bold", +- stretch=500, +- size=14) +- ax.annotate( +- "Bold Font", +- (0.1, 0.2), +- xycoords='axes fraction', +- fontproperties=boldFont) +- +- boldItemFont = find_matplotlib_font( +- family="sans serif", +- style="italic", +- variant="normal", +- weight=750, +- stretch=500, +- size=14) +- ax.annotate( +- "Bold Italic Font", +- (0.1, 0.3), +- xycoords='axes fraction', +- fontproperties=boldItemFont) +- +- lightFont = find_matplotlib_font( +- family="sans-serif", +- style="normal", +- variant="normal", +- weight=200, +- stretch=500, +- size=14) +- ax.annotate( +- "Light Font", +- (0.1, 0.4), +- xycoords='axes fraction', +- fontproperties=lightFont) +- +- condensedFont = find_matplotlib_font( +- family="sans-serif", +- style="normal", +- variant="normal", +- weight=500, +- stretch=100, +- size=14) +- ax.annotate( +- "Condensed Font", +- (0.1, 0.5), +- xycoords='axes fraction', +- fontproperties=condensedFont) +- +- ax.set_xticks([]) +- ax.set_yticks([]) + + + @image_comparison(baseline_images=['multiline']) diff --git a/python-matplotlib-use-system-six.patch b/python-matplotlib-use-system-six.patch new file mode 100644 index 0000000..6250e93 --- /dev/null +++ b/python-matplotlib-use-system-six.patch @@ -0,0 +1,43 @@ +diff -up matplotlib-1.5.1/setupext.py.six matplotlib-1.5.1/setupext.py +--- matplotlib-1.5.1/setupext.py.six 2016-01-10 23:20:20.000000000 +0100 ++++ matplotlib-1.5.1/setupext.py 2016-05-18 13:44:21.534494158 +0200 +@@ -1010,7 +1010,7 @@ class Qhull(SetupPackage): + # present on this system, so check if the header files can be + # found. + include_dirs = [ +- os.path.join(x, 'qhull') for x in get_include_dirs()] ++ os.path.join(x, 'libqhull') for x in get_include_dirs()] + if has_include_file(include_dirs, 'qhull_a.h'): + return 'Using system Qhull (version unknown, no pkg-config info)' + else: +@@ -1026,6 +1026,18 @@ class Qhull(SetupPackage): + ext.sources.extend(glob.glob('extern/qhull/*.c')) + + ++class Six(SetupPackage): ++ name = "six" ++ ++ def check(self): ++ try: ++ import six ++ except ImportError: ++ return 'not found. pip may install it below.' ++ ++ return 'version %s' % six.__version__ ++ ++ + class TTConv(SetupPackage): + name = "ttconv" + +diff -up matplotlib-1.5.1/setup.py.six matplotlib-1.5.1/setup.py +--- matplotlib-1.5.1/setup.py.six 2016-01-10 23:20:20.000000000 +0100 ++++ matplotlib-1.5.1/setup.py 2016-05-18 13:44:21.528494040 +0200 +@@ -84,7 +84,7 @@ mpl_packages = [ + setupext.Delaunay(), + setupext.QhullWrap(), + setupext.Tri(), +- setupext.Externals(), ++ setupext.Six(), + 'Optional subpackages', + setupext.SampleData(), + setupext.Toolkits(), diff --git a/python-matplotlib.spec b/python-matplotlib.spec index c7ca57d..292bd98 100644 --- a/python-matplotlib.spec +++ b/python-matplotlib.spec @@ -6,7 +6,7 @@ %endif %global __provides_exclude_from .*/site-packages/.*\\.so$ %global with_html 1 -%global run_tests 0 +%global run_tests 1 # On RHEL 7 onwards, don't build with wx: %if 0%{?rhel} >= 7 @@ -46,7 +46,7 @@ Name: python-matplotlib Version: 1.5.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Python 2D plotting library Group: Development/Libraries # qt4_editor backend is MIT @@ -59,6 +59,9 @@ Source1: setup.cfg #Patch0: %{name}-noagg.patch Patch2: 20_matplotlibrc_path_search_fix.patch Patch5: 70_bts720549_try_StayPuft_for_xkcd.patch +Patch6: python-matplotlib-use-system-six.patch +Patch7: python-matplotlib-disable-failing-tests.patch +Patch8: python-matplotlib-disable-failing-tests-armv7hl.patch BuildRequires: freetype-devel BuildRequires: libpng-devel @@ -77,7 +80,10 @@ BuildRequires: python2-cycler %endif %if %{run_tests} BuildRequires: python-nose +BuildRequires: python2-cycler +BuildRequires: python2-mock %if %{with_python3} +BuildRequires: python3-mock BuildRequires: python3-nose %endif %endif @@ -346,6 +352,7 @@ Requires: python3-tkinter %prep %setup -q -n matplotlib-%{version} +rm -r lib/matplotlib/externals # Copy setup.cfg to the builddir sed 's/\(backend = \).*/\1%{backend}/' >setup.cfg <%{SOURCE1} @@ -365,6 +372,16 @@ sed -i 's/\(USE_FONTCONFIG = \)False/\1True/' lib/matplotlib/font_manager.py %patch2 -p1 %patch5 -p1 +for f in $(find . -type f -name '*.py' -print) ; do + if grep -q "matplotlib.externals" $f ; then + sed -i -e 's/from matplotlib.externals import six/import six/g' -e 's/from matplotlib.externals.six/from six/g' $f + fi +done +%patch6 -p1 -b .six +%patch7 -p1 -b .tests +%ifarch armv7hl +%patch8 -p1 -b .tests-armv7hl +%endif %if 0%{?fedora} > 24 # Installation paths changed @@ -414,12 +431,11 @@ rm -rf %{buildroot}%{_datadir}/matplotlib/mpl-data/fonts %endif %if %{with_python3} -MPLCONFIGDIR=$PWD/.. \ -MATPLOTLIBDATA=$PWD/../lib/matplotlib/mpl-data/ \ +MPLCONFIGDIR=$PWD \ +MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data/ \ %{__python3} setup.py install -O1 --skip-build --root=%{buildroot} chmod +x %{buildroot}%{python3_sitearch}/matplotlib/dates.py rm -fr %{buildroot}%{python3_sitearch}/matplotlib/mpl-data -rm -f %{buildroot}%{python3_sitearch}/six.py %endif %if %{run_tests} @@ -429,13 +445,13 @@ echo "backend : %{backend}" > matplotlibrc MPLCONFIGDIR=$PWD \ MATPLOTLIBDATA=%{buildroot}%{_datadir}/matplotlib/mpl-data \ PYTHONPATH=%{buildroot}%{python2_sitearch} \ - xvfb-run %{__python} -c "import matplotlib; matplotlib.test()" + xvfb-run -a %{__python2} tests.py --no-network --processes=$(getconf _NPROCESSORS_ONLN) --process-timeout=300 %if %{with_python3} MPLCONFIGDIR=$PWD \ MATPLOTLIBDATA=%{buildroot}%{_datadir}/matplotlib/mpl-data \ PYTHONPATH=%{buildroot}%{python3_sitearch} \ - xvfb-run %{__python3} -c "import matplotlib; matplotlib.test()" + xvfb-run -a %{__python3} tests.py --no-network --processes=$(getconf _NPROCESSORS_ONLN) --process-timeout=300 %endif %endif # run_tests @@ -560,6 +576,12 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} \ %endif %changelog +* Wed May 18 2016 Dominik Mierzejewski - 1.5.1-5 +- Unbundle python-six (#1336740). +- Run tests (and temporarily disable failing ones). +- Use upstream-recommended way of running tests in parallel. +- python2-cycler and -mock are required for running tests. + * Sat Apr 30 2016 Ralf Corsépius - 1.5.1-4 - Rebuild for qhull-2015.2-1. - Reflect qhull_a.h's location having changed.