!3 remove python2 dependency

From: @chengzihan2
Reviewed-by: @jeff200902,@small_leek
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2021-02-19 17:08:09 +08:00 committed by Gitee
commit 46033d17ec
3 changed files with 132 additions and 132 deletions

View File

@ -0,0 +1,116 @@
From d873c282f4ab93f14c6b4ac6f4210852024dba78 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Sat, 2 Mar 2019 18:18:29 -0500
Subject: [PATCH] Use packaged jquery and jquery-ui.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
.../backends/web_backend/all_figures.html | 6 +--
.../backends/web_backend/single_figure.html | 6 +--
setup.py | 49 -------------------
3 files changed, 6 insertions(+), 55 deletions(-)
diff --git a/lib/matplotlib/backends/web_backend/all_figures.html b/lib/matplotlib/backends/web_backend/all_figures.html
index 41f48dc6d..69097eb4f 100644
--- a/lib/matplotlib/backends/web_backend/all_figures.html
+++ b/lib/matplotlib/backends/web_backend/all_figures.html
@@ -3,9 +3,9 @@
<link rel="stylesheet" href="{{ prefix }}/_static/css/page.css" type="text/css">
<link rel="stylesheet" href="{{ prefix }}/_static/css/boilerplate.css" type="text/css" />
<link rel="stylesheet" href="{{ prefix }}/_static/css/fbm.css" type="text/css" />
- <link rel="stylesheet" href="{{ prefix }}/_static/jquery-ui-1.12.1/jquery-ui.min.css" >
- <script src="{{ prefix }}/_static/jquery-ui-1.12.1/external/jquery/jquery.js"></script>
- <script src="{{ prefix }}/_static/jquery-ui-1.12.1/jquery-ui.min.js"></script>
+ <link rel="stylesheet" href="/usr/share/javascript/jquery_ui/jquery-ui.min.css" >
+ <script src="/usr/share/javascript/jquery/latest/jquery.min.js"></script>
+ <script src="/usr/share/javascript/jquery_ui/jquery-ui.min.js"></script>
<script src="{{ prefix }}/_static/js/mpl_tornado.js"></script>
<script src="{{ prefix }}/js/mpl.js"></script>
diff --git a/lib/matplotlib/backends/web_backend/single_figure.html b/lib/matplotlib/backends/web_backend/single_figure.html
index 4d5a366fb..c11c86618 100644
--- a/lib/matplotlib/backends/web_backend/single_figure.html
+++ b/lib/matplotlib/backends/web_backend/single_figure.html
@@ -3,9 +3,9 @@
<link rel="stylesheet" href="{{ prefix }}/_static/css/page.css" type="text/css">
<link rel="stylesheet" href="{{ prefix }}/_static/css/boilerplate.css" type="text/css" />
<link rel="stylesheet" href="{{ prefix }}/_static/css/fbm.css" type="text/css" />
- <link rel="stylesheet" href="{{ prefix }}/_static/jquery-ui-1.12.1/jquery-ui.min.css" >
- <script src="{{ prefix }}/_static/jquery-ui-1.12.1/external/jquery/jquery.js"></script>
- <script src="{{ prefix }}/_static/jquery-ui-1.12.1/jquery-ui.min.js"></script>
+ <link rel="stylesheet" href="/usr/share/javascript/jquery_ui/jquery-ui.min.css" >
+ <script src="/usr/share/javascript/jquery/latest/jquery.min.js"></script>
+ <script src="/usr/share/javascript/jquery_ui/jquery-ui.min.js"></script>
<script src="{{ prefix }}/_static/js/mpl_tornado.js"></script>
<script src="{{ prefix }}/js/mpl.js"></script>
<script>
diff --git a/setup.py b/setup.py
index 41037e95d..7a0af717f 100644
--- a/setup.py
+++ b/setup.py
@@ -35,8 +35,6 @@ from zipfile import ZipFile
from setuptools import setup
from setuptools.command.build_ext import build_ext as BuildExtCommand
-from setuptools.command.develop import develop as DevelopCommand
-from setuptools.command.install_lib import install_lib as InstallLibCommand
from setuptools.command.test import test as TestCommand
# The setuptools version of sdist adds a setup.cfg file to the tree.
@@ -146,53 +144,6 @@ cmdclass['test'] = NoopTestCommand
cmdclass['build_ext'] = BuildExtraLibraries
-def _download_jquery_to(dest):
- # Note: When bumping the jquery-ui version, also update the versions in
- # single_figure.html and all_figures.html.
- url = "https://jqueryui.com/resources/download/jquery-ui-1.12.1.zip"
- sha = 'f8233674366ab36b2c34c577ec77a3d70cac75d2e387d8587f3836345c0f624d'
- if not os.path.exists(os.path.join(dest, "jquery-ui-1.12.1")):
- _makedirs(dest, exist_ok=True)
- try:
- buff = download_or_cache(url, sha)
- except Exception:
- raise IOError("Failed to download jquery-ui. Please download " +
- "{url} and extract it to {dest}.".format(
- url=url, dest=dest))
- with ZipFile(buff) as zf:
- zf.extractall(dest)
-
-
-# Relying on versioneer's implementation detail.
-_orgin_sdist = cmdclass['sdist']
-
-
-class sdist_with_jquery(_orgin_sdist):
- def make_release_tree(self, base_dir, files):
- _orgin_sdist.make_release_tree(self, base_dir, files)
- _download_jquery_to(
- os.path.join(base_dir, "lib/matplotlib/backends/web_backend/"))
-
-
-# Affects install and bdist_wheel.
-class install_lib_with_jquery(InstallLibCommand):
- def run(self):
- InstallLibCommand.run(self)
- _download_jquery_to(
- os.path.join(self.install_dir, "matplotlib/backends/web_backend/"))
-
-
-class develop_with_jquery(DevelopCommand):
- def run(self):
- DevelopCommand.run(self)
- _download_jquery_to("lib/matplotlib/backends/web_backend/")
-
-
-cmdclass['sdist'] = sdist_with_jquery
-cmdclass['install_lib'] = install_lib_with_jquery
-cmdclass['develop'] = develop_with_jquery
-
-
# One doesn't normally see `if __name__ == '__main__'` blocks in a setup.py,
# however, this is needed on Windows to avoid creating infinite subprocesses
# when using multiprocessing.
--
2.20.1

View File

@ -1,109 +1,22 @@
%global debug_package %{nil}
Name: python-matplotlib Name: python-matplotlib
Version: 2.2.4 Version: 2.2.4
Release: 2 Release: 3
Summary: A comprehensive library for creating static, animated, and interactive visualizations Summary: A comprehensive library for creating static, animated, and interactive visualizations
License: Python and MIT License: Python and MIT and OFL-1.1 and BSD-3-Clause
URL: http://matplotlib.org URL: https://github.com/matplotlib/matplotlib
Source0: https://github.com/matplotlib/matplotlib/archive/v%{version}/matplotlib-%{version}.tar.gz Source0: https://github.com/matplotlib/matplotlib/archive/v%{version}/matplotlib-%{version}.tar.gz
# The config file for python-matplotlib # The config file for python-matplotlib
Source1: setup.cfg 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 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
BuildRequires: freetype-devel libpng-devel qhull-devel texlive-cm xorg-x11-server-Xvfb zlib-devel BuildRequires: freetype-devel libpng-devel qhull-devel texlive-cm xorg-x11-server-Xvfb zlib-devel
%description %description
The package produces publication-quality figures in a variety of hardcopy formats and interactive environments The package produces publication-quality figures in a variety of hardcopy formats and interactive environments
across platforms. across platforms.
%package -n python2-matplotlib
Summary: Plotting with Python
BuildRequires: python2-numpy python2-pyparsing python2-dateutil python2-kiwisolver
BuildRequires: python2-pyside python2-setuptools python2-six python2-sphinx python2-subprocess32
BuildRequires: python2-devel python2-backports-functools_lru_cache python2-pillow python2-pytz
Requires: dejavu-sans-fonts dvipng python2-numpy python2-pyparsing python2-cycler >= 0.10.0
Requires: python2-dateutil python2-kiwisolver python2-backports-functools_lru_cache
Requires: python-matplotlib-data = %{version}-%{release} python2-six python2-subprocess32
Requires: python2-matplotlib-tk = %{version}-%{release} python2-pytz
Provides: bundled(stix-math-fonts) bundled(agg) = 2.4 bundled(ttconv) bundled(js-jquery1) = 1.11.3
Provides: bundled(js-jquery1-ui) = 1.11.4 bundled(texlive-helvetic)
Recommends: python2-pillow
%python_provide python2-matplotlib
%description -n python2-matplotlib
The package produces publication-quality figures in a variety of hardcopy formats and interactive environments
across platforms.
%package -n python2-matplotlib-qt4
Summary: Qt4 backend for python-matplotlib
BuildRequires: PyQt4-devel
Requires: python2-PyQt4 python2-matplotlib = %{version}-%{release} python2-matplotlib-qt5
%python_provide python2-matplotlib-qt4
%description -n python2-matplotlib-qt4
The qt4 backend for python-matplotlib.
%package -n python2-matplotlib-qt5
Summary: Qt5 backend for python-matplotlib
BuildRequires: python2-qt5
Requires: python2-qt5 python2-matplotlib = %{version}-%{release}
%python_provide python2-matplotlib-qt5
%description -n python2-matplotlib-qt5
The qt5 backend for python-matplotlib.
%package -n python2-matplotlib-gtk
Summary: GTK backend for python-matplotlib
BuildRequires: gtk2-devel pycairo-devel pygtk2-devel
Requires: pycairo pygtk2 python2-matplotlib = %{version}-%{release}
%python_provide python2-matplotlib-gtk
%description -n python2-matplotlib-gtk
The gtk backend for python-matplotlib.
%package -n python2-matplotlib-gtk3
Summary: GTK3 backend for python-matplotlib
BuildRequires: gtk3 pygobject3-base
Requires: gtk3 pygobject3-base python2-matplotlib = %{version}-%{release}
%python_provide python2-matplotlib-gtk3
%description -n python2-matplotlib-gtk3
The gtk3 backend for python-matplotlib.
%package -n python2-matplotlib-tk
Summary: Tk backend for python-matplotlib
BuildRequires: tcl-devel tkinter tk-devel
Requires: python2-matplotlib = %{version}-%{release} tkinter
%python_provide python2-matplotlib-tk
%description -n python2-matplotlib-tk
The tk backend for python-matplotlib.
%package -n python2-matplotlib-wx
Summary: wxPython backend for python-matplotlib
BuildRequires: wxPython-devel
Requires: python2-matplotlib = %{version}-%{release} python2-wxpython
%python_provide python2-matplotlib-wx
%description -n python2-matplotlib-wx
The wxPython backend for python-matplotlib.
%package -n python2-matplotlib-test-data
Summary: Test data for python2-matplotlib
Requires: python2-matplotlib = %{version}-%{release}
%python_provide python2-matplotlib-test-data
%description -n python2-matplotlib-test-data
Test data for python2-matplotlib.
%package -n python2-matplotlib-help
Summary: Documentation files for python-matplotlib
Requires: python2-matplotlib = %{version}-%{release}
Provides: python2-matplotlib-doc = %{version}-%{release}
Obsoletes: python2-matplotlib-doc < %{version}-%{release}
%python_provide python2-matplotlib-help
%description -n python2-matplotlib-help
Documentation files for python-matplotlib.
%package -n python-matplotlib-data %package -n python-matplotlib-data
Summary: Data used by python-matplotlib Summary: Data used by python-matplotlib
BuildArch: noarch BuildArch: noarch
@ -185,26 +98,23 @@ Test data for python3-matplotlib.
%prep %prep
%autosetup -n matplotlib-%{version} -p1 -N %autosetup -n matplotlib-%{version} -p1 -N
%patch0001 -p1
gzip -dc %SOURCE1000 | tar xvf - --transform='s~^mpl-images-2.2.3-with-freetype-2.9.1/\([^/]\+\)/~lib/\1/tests/baseline_images/~' 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 rm -r extern/libqhull
sed 's/\(backend = \).*/\1TkAgg/' >setup.cfg <%{SOURCE1} sed 's/\(backend = \).*/\1TkAgg/' >setup.cfg <%{SOURCE1}
%build %build
export http_proxy=http://127.0.0.1/ export http_proxy=http://127.0.0.1/
MPLCONFIGDIR=$PWD MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data xvfb-run %{__python2} setup.py build
find examples -name '*.py' -exec chmod a-x '{}' \; find examples -name '*.py' -exec chmod a-x '{}' \;
MPLCONFIGDIR=$PWD MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data xvfb-run %{__python3} setup.py build MPLCONFIGDIR=$PWD MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data xvfb-run %{__python3} setup.py build
%install %install
export http_proxy=http://127.0.0.1/ export http_proxy=http://127.0.0.1/
MPLCONFIGDIR=$PWD MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data/ %{__python2} setup.py install -O1 --skip-build --root=%{buildroot}
chmod +x %{buildroot}%{python2_sitearch}/matplotlib/dates.py
mkdir -p %{buildroot}%{_sysconfdir} %{buildroot}%{_datadir}/matplotlib mkdir -p %{buildroot}%{_sysconfdir} %{buildroot}%{_datadir}/matplotlib
mv %{buildroot}%{python2_sitearch}/matplotlib/mpl-data/matplotlibrc %{buildroot}%{_sysconfdir}
mv %{buildroot}%{python2_sitearch}/matplotlib/mpl-data %{buildroot}%{_datadir}/matplotlib
MPLCONFIGDIR=$PWD MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data/ %{__python3} setup.py install -O1 --skip-build --root=%{buildroot} MPLCONFIGDIR=$PWD MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data/ %{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
mv %{buildroot}%{python3_sitearch}/matplotlib/mpl-data/matplotlibrc %{buildroot}%{_sysconfdir}
mv %{buildroot}%{python3_sitearch}/matplotlib/mpl-data %{buildroot}%{_datadir}/matplotlib
chmod +x %{buildroot}%{python3_sitearch}/matplotlib/dates.py chmod +x %{buildroot}%{python3_sitearch}/matplotlib/dates.py
rm -fr %{buildroot}%{python3_sitearch}/matplotlib/mpl-data
%files -n python-matplotlib-data %files -n python-matplotlib-data
%{_sysconfdir}/matplotlibrc %{_sysconfdir}/matplotlibrc
@ -214,39 +124,6 @@ rm -fr %{buildroot}%{python3_sitearch}/matplotlib/mpl-data
%files -n python-matplotlib-data-fonts %files -n python-matplotlib-data-fonts
%{_datadir}/matplotlib/mpl-data/fonts/ %{_datadir}/matplotlib/mpl-data/fonts/
%files -n python2-matplotlib
%doc README.rst LICENSE/
%{python2_sitearch}/{*egg-info,matplotlib-*-nspkg.pth,matplotlib/,mpl_toolkits/,pylab.py*}
%exclude %{python2_sitearch}/matplotlib/tests/baseline_images/*
%exclude %{python2_sitearch}/mpl_toolkits/tests/baseline_images/*
%exclude %{python2_sitearch}/matplotlib/backends/{backend_qt4*,backend_qt5*,backend_gtk*,_gtkagg.*,backend_tkagg.*}
%exclude %{python2_sitearch}/matplotlib/backends/{tkagg.*,_tkagg.so,backend_wx.*,backend_wxagg.*}
%exclude %{_pkgdocdir}/{*,*/*}
%files -n python2-matplotlib-test-data
%{python2_sitearch}/matplotlib/tests/baseline_images/
%{python2_sitearch}/mpl_toolkits/tests/baseline_images/
%files -n python2-matplotlib-qt4
%{python2_sitearch}/matplotlib/backends/{backend_qt4.*,backend_qt4agg.*}
%files -n python2-matplotlib-qt5
%{python2_sitearch}/matplotlib/backends/{backend_qt5.*,backend_qt5agg.*}
%files -n python2-matplotlib-gtk
%{python2_sitearch}/matplotlib/backends/{backend_gtk.py*,backend_gtkagg.py*,backend_gtkcairo.py*,_gtkagg.so}
%files -n python2-matplotlib-gtk3
%{python2_sitearch}/matplotlib/backends/backend_gtk3*.py*
%files -n python2-matplotlib-tk
%{python2_sitearch}/matplotlib/backends/{backend_tkagg.py*,tkagg.py*,_tkagg.so}
%files -n python2-matplotlib-wx
%{python2_sitearch}/matplotlib/backends/{backend_wx.*,backend_wxagg.*}
%files -n python2-matplotlib-help
%doc examples
%files -n python3-matplotlib %files -n python3-matplotlib
%doc README.rst LICENSE/ %doc README.rst LICENSE/
@ -282,5 +159,8 @@ rm -fr %{buildroot}%{python3_sitearch}/matplotlib/mpl-data
%{python3_sitearch}/matplotlib/backends/{tkagg.*,__pycache__/tkagg.*,_tkagg.*} %{python3_sitearch}/matplotlib/backends/{tkagg.*,__pycache__/tkagg.*,_tkagg.*}
%changelog %changelog
* Fri Feb 19 2021 liyanan <liyanan32@huawei.com> - 2.2.4-3
- remove python2 dependency
* Fri Mar 6 2020 chenli <chenli147@huawei.com> - 2.2.4-2 * Fri Mar 6 2020 chenli <chenli147@huawei.com> - 2.2.4-2
- Init Package - Init Package

4
python-matplotlib.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: matplotlib/matplotlib
tag_prefix: "^v"
separator: "."