Blob Blame Raw
From a587261dcf6821dd03e1956cc1644a3a7aaa4031 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                                      | 46 -------------------
 3 files changed, 6 insertions(+), 52 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 d5ff91c43..a2b82f692 100644
--- a/setup.py
+++ b/setup.py
@@ -26,8 +26,6 @@ from zipfile import ZipFile
 
 from setuptools import setup, 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.
@@ -123,50 +121,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")):
-        os.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.
-class sdist_with_jquery(cmdclass['sdist']):
-    def make_release_tree(self, base_dir, files):
-        super(sdist_with_jquery, self).make_release_tree(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):
-        super(install_lib_with_jquery, self).run()
-        _download_jquery_to(
-            os.path.join(self.install_dir, "matplotlib/backends/web_backend/"))
-
-
-class develop_with_jquery(DevelopCommand):
-    def run(self):
-        super(develop_with_jquery, self).run()
-        _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.21.0