Skip to content

Commit

Permalink
Remove jQuery and jQuery UI.
Browse files Browse the repository at this point in the history
It's now unused, except specfically in the IPython inline figure HTML,
but we know it's available there.
  • Loading branch information
QuLogic committed Apr 9, 2020
1 parent 7b7c62e commit 707d820
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 67 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Expand Up @@ -102,7 +102,5 @@ lib/z.lib

# Vendored dependencies #
#########################

jquery-ui-*/
lib/matplotlib/backends/web_backend/node_modules/
lib/matplotlib/backends/web_backend/package-lock.json
3 changes: 0 additions & 3 deletions examples/user_interfaces/embedding_webagg_sgskip.py
Expand Up @@ -60,9 +60,6 @@ def create_figure():
type="text/css" />
<link rel="stylesheet" href="_static/css/fbm.css" type="text/css" />
<link rel="stylesheet" href="_static/css/mpl.css" type="text/css">
<link rel="stylesheet" href="_static/jquery-ui-1.12.1/jquery-ui.min.css" />
<script src="_static/jquery-ui-1.12.1/external/jquery/jquery.js"></script>
<script src="_static/jquery-ui-1.12.1/jquery-ui.min.js"></script>
<script src="mpl.js"></script>
<script>
Expand Down
3 changes: 0 additions & 3 deletions lib/matplotlib/backends/web_backend/all_figures.html
Expand Up @@ -4,9 +4,6 @@
<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/css/mpl.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>
<script src="{{ prefix }}/_static/js/mpl_tornado.js"></script>
<script src="{{ prefix }}/js/mpl.js"></script>

Expand Down
3 changes: 0 additions & 3 deletions lib/matplotlib/backends/web_backend/single_figure.html
Expand Up @@ -4,9 +4,6 @@
<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/css/mpl.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>
<script src="{{ prefix }}/_static/js/mpl_tornado.js"></script>
<script src="{{ prefix }}/js/mpl.js"></script>
<script>
Expand Down
57 changes: 1 addition & 56 deletions setup.py
Expand Up @@ -21,13 +21,9 @@
sys.exit(error)

from pathlib import Path
import shutil
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.
Expand All @@ -43,7 +39,7 @@
from distutils.dist import Distribution

import setupext
from setupext import print_raw, print_status, download_or_cache
from setupext import print_raw, print_status

# Get the version from versioneer
import versioneer
Expand Down Expand Up @@ -94,57 +90,6 @@ def build_extensions(self):
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(f"Failed to download jquery-ui. Please download "
f"{url} and extract it to {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.
Expand Down

0 comments on commit 707d820

Please sign in to comment.