Cconditionally to bundle fonts (#1047559)
This commit is contained in:
parent
b69e56e8d0
commit
12e8a6231d
29
20_matplotlibrc_path_search_fix.patch
Normal file
29
20_matplotlibrc_path_search_fix.patch
Normal file
@ -0,0 +1,29 @@
|
||||
Description: Fixes the path to search for matplotlibrc file
|
||||
Forwarded: not-needed
|
||||
Author: Sandro Tosi <morph@debian.org>
|
||||
|
||||
--- a/lib/matplotlib/__init__.py
|
||||
+++ b/lib/matplotlib/__init__.py
|
||||
@@ -607,10 +607,12 @@ def _get_data_path():
|
||||
raise RuntimeError('Path in environment MATPLOTLIBDATA not a directory')
|
||||
return path
|
||||
|
||||
- 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
|
||||
@@ -727,7 +729,7 @@ def matplotlib_fname():
|
||||
_get_xdg_config_dir())
|
||||
return fname
|
||||
|
||||
- path = get_data_path() # guaranteed to exist or raise
|
||||
+ path = '/etc' # guaranteed to exist or raise
|
||||
fname = os.path.join(path, 'matplotlibrc')
|
||||
if not os.path.exists(fname):
|
||||
warnings.warn('Could not find matplotlibrc; using defaults')
|
14
40_bts608939_draw_markers_description.patch
Normal file
14
40_bts608939_draw_markers_description.patch
Normal file
@ -0,0 +1,14 @@
|
||||
Description: minor glitch in draw_markers() description
|
||||
Author: Jakub Wilk <jwilk@debian.org>
|
||||
|
||||
--- a/doc/api/api_changes.rst
|
||||
+++ b/doc/api/api_changes.rst
|
||||
@@ -919,7 +919,7 @@ New methods:
|
||||
|
||||
* :meth:`draw_markers(self, gc, marker_path, marker_trans, path,
|
||||
trans, rgbFace)
|
||||
- <matplotlib.backend_bases.RendererBase.draw_markers`
|
||||
+ <matplotlib.backend_bases.RendererBase.draw_markers>`
|
||||
|
||||
* :meth:`draw_path_collection(self, master_transform, cliprect,
|
||||
clippath, clippath_trans, paths, all_transforms, offsets,
|
49
50_bts608942_spaces_in_param_args.patch
Normal file
49
50_bts608942_spaces_in_param_args.patch
Normal file
@ -0,0 +1,49 @@
|
||||
Description: don't separate param and its argument with a space
|
||||
|
||||
--- a/lib/mpl_toolkits/axes_grid1/axes_divider.py
|
||||
+++ b/lib/mpl_toolkits/axes_grid1/axes_divider.py
|
||||
@@ -201,12 +201,12 @@ class Divider(object):
|
||||
def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
|
||||
"""
|
||||
|
||||
- :param nx, nx1: Integers specifying the column-position of the
|
||||
+ :param nx,nx1: Integers specifying the column-position of the
|
||||
cell. When nx1 is None, a single nx-th column is
|
||||
specified. Otherwise location of columns spanning between nx
|
||||
to nx1 (but excluding nx1-th column) is specified.
|
||||
|
||||
- :param ny, ny1: same as nx and nx1, but for row positions.
|
||||
+ :param ny,ny1: same as nx and nx1, but for row positions.
|
||||
"""
|
||||
|
||||
|
||||
@@ -253,12 +253,12 @@ class Divider(object):
|
||||
(:class:`mpl_toolkits.axes_grid.axes_divider.AxesLocator`) for
|
||||
specified cell.
|
||||
|
||||
- :param nx, nx1: Integers specifying the column-position of the
|
||||
+ :param nx,nx1: Integers specifying the column-position of the
|
||||
cell. When nx1 is None, a single nx-th column is
|
||||
specified. Otherwise location of columns spanning between nx
|
||||
to nx1 (but excluding nx1-th column) is specified.
|
||||
|
||||
- :param ny, ny1: same as nx and nx1, but for row positions.
|
||||
+ :param ny,ny1: same as nx and nx1, but for row positions.
|
||||
"""
|
||||
return AxesLocator(self, nx, ny, nx1, ny1)
|
||||
|
||||
@@ -299,12 +299,12 @@ class AxesLocator(object):
|
||||
"""
|
||||
:param axes_divider: An instance of AxesDivider class.
|
||||
|
||||
- :param nx, nx1: Integers specifying the column-position of the
|
||||
+ :param nx,nx1: Integers specifying the column-position of the
|
||||
cell. When nx1 is None, a single nx-th column is
|
||||
specified. Otherwise location of columns spanning between nx
|
||||
to nx1 (but excluding nx1-th column) is is specified.
|
||||
|
||||
- :param ny, ny1: same as nx and nx1, but for row positions.
|
||||
+ :param ny,ny1: same as nx and nx1, but for row positions.
|
||||
"""
|
||||
self._axes_divider = axes_divider
|
||||
|
111
60_deal_with_no_writable_dirs.patch
Normal file
111
60_deal_with_no_writable_dirs.patch
Normal file
@ -0,0 +1,111 @@
|
||||
Description: deal with the case where there are no writable directories.
|
||||
Author: Michael Droettboom <mdboom@gmail.com>
|
||||
Bug-Debian: http://bugs.debian.org/719384
|
||||
Origin: https://github.com/mdboom/matplotlib/commit/1e8d592ed0439ac6fe8fc08d5efe522799acf4fe
|
||||
Reviewed-By: Anton Gladky <gladk@debian.org>
|
||||
Last-Update: 2013-09-29
|
||||
|
||||
--- matplotlib-1.3.0.orig/lib/matplotlib/font_manager.py
|
||||
+++ matplotlib-1.3.0/lib/matplotlib/font_manager.py
|
||||
@@ -1324,6 +1324,8 @@ if USE_FONTCONFIG and sys.platform != 'w
|
||||
return result
|
||||
|
||||
else:
|
||||
+ _fmcache = None
|
||||
+
|
||||
if not 'TRAVIS' in os.environ:
|
||||
cachedir = get_cachedir()
|
||||
if cachedir is not None:
|
||||
@@ -1331,8 +1333,6 @@ else:
|
||||
_fmcache = os.path.join(cachedir, 'fontList.py3k.cache')
|
||||
else:
|
||||
_fmcache = os.path.join(cachedir, 'fontList.cache')
|
||||
- else:
|
||||
- _fmcache = None
|
||||
|
||||
fontManager = None
|
||||
|
||||
--- matplotlib-1.3.0.orig/lib/matplotlib/__init__.py
|
||||
+++ matplotlib-1.3.0/lib/matplotlib/__init__.py
|
||||
@@ -518,7 +518,11 @@ def _get_xdg_config_dir():
|
||||
base directory spec
|
||||
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
|
||||
"""
|
||||
- return os.environ.get('XDG_CONFIG_HOME', os.path.join(get_home(), '.config'))
|
||||
+ home = get_home()
|
||||
+ if home is None:
|
||||
+ return None
|
||||
+ else:
|
||||
+ return os.environ.get('XDG_CONFIG_HOME', os.path.join(home, '.config'))
|
||||
|
||||
|
||||
def _get_xdg_cache_dir():
|
||||
@@ -527,7 +531,11 @@ def _get_xdg_cache_dir():
|
||||
base directory spec
|
||||
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
|
||||
"""
|
||||
- return os.environ.get('XDG_CACHE_HOME', os.path.join(get_home(), '.cache'))
|
||||
+ home = get_home()
|
||||
+ if home is None:
|
||||
+ return None
|
||||
+ else:
|
||||
+ return os.environ.get('XDG_CACHE_HOME', os.path.join(home, '.cache'))
|
||||
|
||||
|
||||
def _get_config_or_cache_dir(xdg_base):
|
||||
@@ -543,22 +551,28 @@ def _get_config_or_cache_dir(xdg_base):
|
||||
return _create_tmp_config_dir()
|
||||
return configdir
|
||||
|
||||
+ p = None
|
||||
h = get_home()
|
||||
- p = os.path.join(h, '.matplotlib')
|
||||
- if (sys.platform.startswith('linux') and
|
||||
- not os.path.exists(p)):
|
||||
- p = os.path.join(xdg_base, 'matplotlib')
|
||||
-
|
||||
- if os.path.exists(p):
|
||||
- if not _is_writable_dir(p):
|
||||
- return _create_tmp_config_dir()
|
||||
- else:
|
||||
- try:
|
||||
- mkdirs(p)
|
||||
- except OSError:
|
||||
- return _create_tmp_config_dir()
|
||||
+ if h is not None:
|
||||
+ p = os.path.join(h, '.matplotlib')
|
||||
+ if (sys.platform.startswith('linux') and
|
||||
+ not os.path.exists(p) and
|
||||
+ xdg_base is not None):
|
||||
+ p = os.path.join(xdg_base, 'matplotlib')
|
||||
+
|
||||
+ if p is not None:
|
||||
+ if os.path.exists(p):
|
||||
+ if _is_writable_dir(p):
|
||||
+ return p
|
||||
+ else:
|
||||
+ try:
|
||||
+ mkdirs(p)
|
||||
+ except OSError:
|
||||
+ pass
|
||||
+ else:
|
||||
+ return p
|
||||
|
||||
- return p
|
||||
+ return _create_tmp_config_dir()
|
||||
|
||||
|
||||
def _get_configdir():
|
||||
@@ -716,9 +730,11 @@ def matplotlib_fname():
|
||||
if configdir is not None:
|
||||
fname = os.path.join(configdir, 'matplotlibrc')
|
||||
if os.path.exists(fname):
|
||||
+ home = get_home()
|
||||
if (sys.platform.startswith('linux') and
|
||||
+ home is not None and
|
||||
fname == os.path.join(
|
||||
- get_home(), '.matplotlib', 'matplotlibrc')):
|
||||
+ home, '.matplotlib', 'matplotlibrc')):
|
||||
warnings.warn(
|
||||
"Found matplotlib configuration in ~/.matplotlib/. "
|
||||
"To conform with the XDG base directory standard, "
|
19
70_bts720549_try_StayPuft_for_xkcd.patch
Normal file
19
70_bts720549_try_StayPuft_for_xkcd.patch
Normal file
@ -0,0 +1,19 @@
|
||||
Description: Try to use also StayPuft (a free font) for xkcd
|
||||
Author: Sandro Tosi <morph@debian.org>
|
||||
Origin: vendor
|
||||
Bug: http://bugs.debian.org/720549
|
||||
Forwarded: not-needed
|
||||
Last-Update: 2013-10-06
|
||||
---
|
||||
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
||||
--- a/lib/matplotlib/pyplot.py
|
||||
+++ b/lib/matplotlib/pyplot.py
|
||||
@@ -289,7 +289,7 @@ def xkcd(scale=1, length=100, randomness
|
||||
from matplotlib import patheffects
|
||||
context = rc_context()
|
||||
try:
|
||||
- rcParams['font.family'] = ['Humor Sans', 'Comic Sans MS']
|
||||
+ rcParams['font.family'] = ['Humor Sans', 'Comic Sans MS', 'StayPuft']
|
||||
rcParams['font.size'] = 14.0
|
||||
rcParams['path.sketch'] = (scale, length, randomness)
|
||||
rcParams['path.effects'] = [
|
@ -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
|
||||
@ -15,10 +15,12 @@
|
||||
%global with_wx 1
|
||||
%endif
|
||||
|
||||
# https://fedorahosted.org/fpc/ticket/381
|
||||
%global with_bundled_fonts 1
|
||||
|
||||
Name: python-matplotlib
|
||||
Version: 1.3.1
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Python 2D plotting library
|
||||
Group: Development/Libraries
|
||||
# qt4_editor backend is MIT
|
||||
@ -33,6 +35,11 @@ Source1: setup.cfg
|
||||
|
||||
Patch0: %{name}-noagg.patch
|
||||
Patch1: %{name}-system-cxx.patch
|
||||
Patch2: 20_matplotlibrc_path_search_fix.patch
|
||||
Patch3: 40_bts608939_draw_markers_description.patch
|
||||
Patch4: 50_bts608942_spaces_in_param_args.patch
|
||||
Patch5: 60_deal_with_no_writable_dirs.patch
|
||||
Patch6: 70_bts720549_try_StayPuft_for_xkcd.patch
|
||||
|
||||
BuildRequires: agg-devel
|
||||
BuildRequires: freetype-devel
|
||||
@ -48,6 +55,12 @@ BuildRequires: python-setuptools
|
||||
%if %{with_html}
|
||||
BuildRequires: python-numpydoc
|
||||
%endif
|
||||
%if %{run_tests}
|
||||
BuildRequires: python-nose
|
||||
%if %{with_python3}
|
||||
BuildRequires: python3-nose
|
||||
%endif
|
||||
%endif
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: pytz
|
||||
BuildRequires: xorg-x11-server-Xvfb
|
||||
@ -65,6 +78,7 @@ Requires: stix-math-fonts
|
||||
%else
|
||||
Requires: stix-fonts
|
||||
%endif
|
||||
Requires: %{name}-data = %{version}-%{release}
|
||||
|
||||
%description
|
||||
Matplotlib is a python 2D plotting library which produces publication
|
||||
@ -124,6 +138,27 @@ BuildRequires: dvipng
|
||||
%description doc
|
||||
%{summary}
|
||||
|
||||
%package data
|
||||
Summary: Data used by python-matplotlib
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
%if %{with_bundled_fonts}
|
||||
Requires: %{name}-data-fonts = %{version}-%{release}
|
||||
%endif
|
||||
BuildArch: noarch
|
||||
|
||||
%description data
|
||||
%{summary}
|
||||
|
||||
%if %{with_bundled_fonts}
|
||||
%package data-fonts
|
||||
Summary: Fonts used by python-matplotlib
|
||||
Requires: %{name}-data = %{version}-%{release}
|
||||
BuildArch: noarch
|
||||
|
||||
%description data-fonts
|
||||
%{summary}
|
||||
%endif
|
||||
|
||||
%if %{with_python3}
|
||||
%package -n python3-matplotlib
|
||||
Summary: Python 2D plotting library
|
||||
@ -148,6 +183,7 @@ Requires: stix-math-fonts
|
||||
%else
|
||||
Requires: stix-fonts
|
||||
%endif
|
||||
Requires: %{name}-data = %{version}-%{release}
|
||||
|
||||
%description -n python3-matplotlib
|
||||
Matplotlib is a python 2D plotting library which produces publication
|
||||
@ -187,8 +223,18 @@ Requires: python3-tkinter
|
||||
# Copy setup.cfg to the builddir
|
||||
cp %{SOURCE1} .
|
||||
|
||||
# Keep this until next version, and increment if changing from
|
||||
# USE_FONTCONFIG to False or True so that cache is regenerated
|
||||
# if updated from a version enabling fontconfig to one not
|
||||
# enabling it, or vice versa
|
||||
if [ %{version} = 1.3.1 ]; then
|
||||
sed -i 's/\(__version__ = 101\)/\1.1/' lib/matplotlib/font_manager.py
|
||||
fi
|
||||
|
||||
%if !%{with_bundled_fonts}
|
||||
# Use fontconfig by default
|
||||
sed -i 's/\(USE_FONTCONFIG = \)False/\1True/' lib/matplotlib/font_manager.py
|
||||
%endif
|
||||
|
||||
# Remove bundled libraries
|
||||
rm -r agg24 CXX
|
||||
@ -196,6 +242,11 @@ rm -r agg24 CXX
|
||||
# Remove references to bundled libraries
|
||||
%patch0 -b .noagg
|
||||
%patch1 -b .cxx
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
|
||||
chmod -x lib/matplotlib/mpl-data/images/*.svg
|
||||
|
||||
@ -205,12 +256,16 @@ cp -a . %{py3dir}
|
||||
%endif
|
||||
|
||||
%build
|
||||
xvfb-run %{__python2} setup.py build
|
||||
MPLCONFIGDIR=$PWD \
|
||||
MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data \
|
||||
xvfb-run %{__python2} setup.py build
|
||||
%if %{with_html}
|
||||
# Need to make built matplotlib libs available for the sphinx extensions:
|
||||
pushd doc
|
||||
export PYTHONPATH=`realpath ../build/lib.linux*`
|
||||
%{__python2} make.py html
|
||||
MPLCONFIGDIR=$PWD/.. \
|
||||
MATPLOTLIBDATA=$PWD/../lib/matplotlib/mpl-data \
|
||||
PYTHONPATH=`realpath ../build/lib.linux*` \
|
||||
%{__python2} make.py html
|
||||
popd
|
||||
%endif
|
||||
# Ensure all example files are non-executable so that the -doc
|
||||
@ -219,34 +274,53 @@ find examples -name '*.py' -exec chmod a-x '{}' \;
|
||||
|
||||
%if %{with_python3}
|
||||
pushd %{py3dir}
|
||||
xvfb-run %{__python3} setup.py build
|
||||
MPLCONFIGDIR=$PWD \
|
||||
MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data \
|
||||
xvfb-run %{__python3} setup.py build
|
||||
# documentation cannot be built with python3 due to syntax errors
|
||||
# and building with python 2 exits with cryptic error messages
|
||||
popd
|
||||
%endif
|
||||
|
||||
%install
|
||||
%{__python} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT
|
||||
MPLCONFIGDIR=$PWD \
|
||||
MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data/ \
|
||||
%{__python} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT
|
||||
chmod +x $RPM_BUILD_ROOT%{python_sitearch}/matplotlib/dates.py
|
||||
rm -rf $RPM_BUILD_ROOT%{python_sitearch}/matplotlib/mpl-data/fonts
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir} $RPM_BUILD_ROOT%{_datadir}/matplotlib
|
||||
mv $RPM_BUILD_ROOT%{python_sitearch}/matplotlib/mpl-data/matplotlibrc \
|
||||
$RPM_BUILD_ROOT%{_sysconfdir}
|
||||
mv $RPM_BUILD_ROOT%{python_sitearch}/matplotlib/mpl-data \
|
||||
$RPM_BUILD_ROOT%{_datadir}/matplotlib
|
||||
%if !%{with_bundled_fonts}
|
||||
rm -rf $RPM_BUILD_ROOT%{_datadir}/matplotlib/mpl-data/fonts
|
||||
%endif
|
||||
|
||||
%if %{with_python3}
|
||||
pushd %{py3dir}
|
||||
%{__python3} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT
|
||||
MPLCONFIGDIR=$PWD/.. \
|
||||
MATPLOTLIBDATA=$PWD/../lib/matplotlib/mpl-data/ \
|
||||
%{__python3} setup.py install -O1 --skip-build --root=$RPM_BUILD_ROOT
|
||||
chmod +x $RPM_BUILD_ROOT%{python3_sitearch}/matplotlib/dates.py
|
||||
rm -rf $RPM_BUILD_ROOT%{python3_sitearch}/matplotlib/mpl-data/fonts
|
||||
rm -fr $RPM_BUILD_ROOT%{python3_sitearch}/matplotlib/mpl-data
|
||||
rm -f $RPM_BUILD_ROOT%{python3_sitearch}/six.py
|
||||
popd
|
||||
%endif
|
||||
|
||||
%if %{run_tests}
|
||||
%check
|
||||
PYTHON_PATH=$RPM_BUILD_ROOT%{python_sitearch} \
|
||||
%{__python} -c "import matplotlib; matplotlib.test()"
|
||||
# This should match the default backend
|
||||
echo "backend : GTKAgg" > matplotlibrc
|
||||
MPLCONFIGDIR=$PWD \
|
||||
MATPLOTLIBDATA=$RPM_BUILD_ROOT%{_datadir}/matplotlib/mpl-data \
|
||||
PYTHONPATH=$RPM_BUILD_ROOT%{python_sitearch} \
|
||||
xvfb-run %{__python} -c "import matplotlib; matplotlib.test()"
|
||||
|
||||
%if %{with_python3}
|
||||
PYTHON_PATH=$RPM_BUILD_ROOT%{python3_sitearch} \
|
||||
%{__python3} -c "import matplotlib; matplotlib.test()"
|
||||
MPLCONFIGDIR=$PWD \
|
||||
MATPLOTLIBDATA=$RPM_BUILD_ROOT%{_datadir}/matplotlib/mpl-data \
|
||||
PYTHONPATH=$RPM_BUILD_ROOT%{python3_sitearch} \
|
||||
xvfb-run %{__python3} -c "import matplotlib; matplotlib.test()"
|
||||
%endif
|
||||
%endif # run_tests
|
||||
|
||||
@ -291,6 +365,18 @@ PYTHON_PATH=$RPM_BUILD_ROOT%{python3_sitearch} \
|
||||
%doc doc/build/html/*
|
||||
%endif
|
||||
|
||||
%files data
|
||||
%{_sysconfdir}/matplotlibrc
|
||||
%{_datadir}/matplotlib/mpl-data/
|
||||
%if %{with_bundled_fonts}
|
||||
%exclude %{_datadir}/matplotlib/mpl-data/fonts/
|
||||
%endif
|
||||
|
||||
%if %{with_bundled_fonts}
|
||||
%files data-fonts
|
||||
%{_datadir}/matplotlib/mpl-data/fonts/
|
||||
%endif
|
||||
|
||||
%if %{with_python3}
|
||||
%files -n python3-matplotlib
|
||||
%doc %{basepy3dir}/README.rst
|
||||
@ -331,6 +417,12 @@ PYTHON_PATH=$RPM_BUILD_ROOT%{python3_sitearch} \
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Jan 27 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.3.1-2
|
||||
- Correct environment for and enable %%check
|
||||
- Install system wide matplotlibrc under /etc
|
||||
- Do not duplicate mpl-data for python2 and python3 packages
|
||||
- Conditionally bundle data fonts (https://fedorahosted.org/fpc/ticket/381)
|
||||
|
||||
* Sat Jan 25 2014 Thomas Spura <tomspur@fedoraproject.org> - 1.3.1-1
|
||||
- update to 1.3.1
|
||||
- use GTKAgg as backend (#1030396, #982793, #1049624)
|
||||
|
Loading…
Reference in New Issue
Block a user