python-matplotlib/0001-Use-packaged-jquery-an...

122 lines
5.5 KiB
Diff

From a3fec73e39558f1a8d41663fe05783889e735af4 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 | 54 -------------------
3 files changed, 6 insertions(+), 60 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 bf03159fb..81c2f96d7 100644
--- a/setup.py
+++ b/setup.py
@@ -28,8 +28,6 @@ from zipfile import ZipFile
from setuptools import setup, find_packages, Extension
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.
@@ -120,58 +118,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"
- name = Path(url).stem
- if (dest / name).exists():
- return
- # If we are installing from an sdist, use the already downloaded jquery-ui.
- sdist_src = Path("lib/matplotlib/backends/web_backend", name)
- if sdist_src.exists():
- shutil.copytree(sdist_src, dest / name)
- return
- if not (dest / name).exists():
- dest.mkdir(parents=True, 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.
-class sdist_with_jquery(cmdclass['sdist']):
- def make_release_tree(self, base_dir, files):
- super().make_release_tree(base_dir, files)
- _download_jquery_to(
- Path(base_dir, "lib/matplotlib/backends/web_backend/"))
-
-
-# Affects install and bdist_wheel.
-class install_lib_with_jquery(InstallLibCommand):
- def run(self):
- super().run()
- _download_jquery_to(
- Path(self.install_dir, "matplotlib/backends/web_backend/"))
-
-
-class develop_with_jquery(DevelopCommand):
- def run(self):
- super().run()
- _download_jquery_to(Path("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.25.4