diff --git a/bokeh-pr11174-replace-jinja2-markup.patch b/bokeh-pr11174-replace-jinja2-markup.patch new file mode 100644 index 0000000..8e6f9a8 --- /dev/null +++ b/bokeh-pr11174-replace-jinja2-markup.patch @@ -0,0 +1,131 @@ +From 7047c6a90535564c9d05121fc8a095aef1de3c21 Mon Sep 17 00:00:00 2001 +From: kernc +Date: Wed, 21 Apr 2021 17:29:22 +0200 +Subject: [PATCH] Replace deprecated jinja2.Markup with jinja2.tojson (#11174) + +* Replace deprecated jinja2.Markup -> markupsafe.Markup + +* Expose |tojson as |json. Bump Jinja2 >=2.9 + +* Replace |json filter with jinja's |tojson throughout + +* Fix test_autoload_template_has_changed +--- + _setup_support.py | 2 +- + bokeh/core/_templates/autoload_js.js | 14 +++++++------- + bokeh/core/_templates/autoload_nb_js.js | 6 +++--- + bokeh/core/templates.py | 4 +--- + tests/unit/bokeh/core/test_templates.py | 2 +- + 5 files changed, 13 insertions(+), 15 deletions(-) + +diff --git a/bokeh/core/_templates/autoload_js.js b/bokeh/core/_templates/autoload_js.js +index 792a74c7cc2..d15ea9778e6 100644 +--- a/bokeh/core/_templates/autoload_js.js ++++ b/bokeh/core/_templates/autoload_js.js +@@ -20,7 +20,7 @@ calls it with the rendered model. + return new Date(); + } + +- var force = {{ force|default(False)|json }}; ++ var force = {{ force|default(False)|tojson }}; + + if (typeof root._bokeh_onload_callbacks === "undefined" || force === true) { + root._bokeh_onload_callbacks = []; +@@ -32,7 +32,7 @@ calls it with the rendered model. + + {% block autoload_init %} + {%- if elementid -%} +- var element = document.getElementById({{ elementid|json }}); ++ var element = document.getElementById({{ elementid|tojson }}); + if (element == null) { + console.warn("Bokeh: autoload.js configured with elementid '{{ elementid }}' but no matching script tag was found.") + } +@@ -91,7 +91,7 @@ calls it with the rendered model. + document.body.appendChild(element); + } + +- const hashes = {{ bundle.hashes|json }}; ++ const hashes = {{ bundle.hashes|tojson }}; + + for (let i = 0; i < js_urls.length; i++) { + const url = js_urls[i]; +@@ -110,17 +110,17 @@ calls it with the rendered model. + } + + {% if bundle %} +- var js_urls = {{ bundle.js_urls|json }}; +- var css_urls = {{ bundle.css_urls|json }}; ++ var js_urls = {{ bundle.js_urls|tojson }}; ++ var css_urls = {{ bundle.css_urls|tojson }}; + {% else %} +- var js_urls = {{ js_urls|json }}; +- var css_urls = {{ css_urls|json }}; ++ var js_urls = {{ js_urls|tojson }}; ++ var css_urls = {{ css_urls|tojson }}; + {% endif %} + + var inline_js = [ + {%- for css in (bundle.css_raw if bundle else css_raw) %} + function(Bokeh) { +- inject_raw_css({{ css|json }}); ++ inject_raw_css({{ css|tojson }}); + }, + {%- endfor %} + {%- for js in (bundle.js_raw if bundle else js_raw) %} +diff --git a/bokeh/core/_templates/autoload_nb_js.js b/bokeh/core/_templates/autoload_nb_js.js +index 2c75850b2b4..ca96a59cd2d 100644 +--- a/bokeh/core/_templates/autoload_nb_js.js ++++ b/bokeh/core/_templates/autoload_nb_js.js +@@ -132,7 +132,7 @@ + + {% block autoload_init %} + if (typeof (root._bokeh_timeout) === "undefined" || force === true) { +- root._bokeh_timeout = Date.now() + {{ timeout|default(0)|json }}; ++ root._bokeh_timeout = Date.now() + {{ timeout|default(0)|tojson }}; + root._bokeh_failed_load = false; + } + +@@ -153,7 +153,7 @@ + ""}}; + + function display_loaded() { +- var el = document.getElementById({{ elementid|json }}); ++ var el = document.getElementById({{ elementid|tojson }}); + if (el != null) { + el.textContent = "BokehJS is loading..."; + } +@@ -181,7 +181,7 @@ + console.log("Bokeh: BokehJS failed to load within specified timeout."); + root._bokeh_failed_load = true; + } else if (force !== true) { +- var cell = $(document.getElementById({{ elementid|json }})).parents('.cell').data().cell; ++ var cell = $(document.getElementById({{ elementid|tojson }})).parents('.cell').data().cell; + cell.output_area.append_execute_result(NB_LOAD_WARNING) + } + {% endblock %} +diff --git a/bokeh/core/templates.py b/bokeh/core/templates.py +index 10344ecaf7d..c7cd25ea7f2 100644 +--- a/bokeh/core/templates.py ++++ b/bokeh/core/templates.py +@@ -36,12 +36,11 @@ + #----------------------------------------------------------------------------- + + # Standard library imports +-import json + import sys + from os.path import dirname, join + + # External imports +-from jinja2 import Environment, FileSystemLoader, Markup ++from jinja2 import Environment, FileSystemLoader + + #----------------------------------------------------------------------------- + # Globals and constants +@@ -86,7 +85,6 @@ def get_env(): + #----------------------------------------------------------------------------- + + _env = get_env() +-_env.filters['json'] = lambda obj: Markup(json.dumps(obj)) + + #----------------------------------------------------------------------------- + # General API diff --git a/python-bokeh.spec b/python-bokeh.spec index 0104f81..f7a35ba 100644 --- a/python-bokeh.spec +++ b/python-bokeh.spec @@ -13,7 +13,7 @@ and data applications.} Name: python-%{pypi_name} Version: 2.3.0 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Interactive plots and applications in the browser from Python # License breakdown: licensecheck -r . | sed '/UNKNOWN/ d' | sort -t ':' -k 2 @@ -68,6 +68,9 @@ Source1: parse-deps.py # From https://github.com/bokeh/bokeh/commit/865c54896e6158c1195e5ec8352f300cbf10920f # https://github.com/bokeh/bokeh/pull/10987 Patch0: bokeh-pr10987-python312-configparser.patch +# https://github.com/bokeh/bokeh/commit/7047c6a90535564c9d05121fc8a095aef1de3c21 +# https://github.com/bokeh/bokeh/pull/11174 +Patch1: bokeh-pr11174-replace-jinja2-markup.patch BuildArch: noarch @@ -222,6 +225,9 @@ rm -f %{buildroot}/%{python3_sitelib}/bokeh/server/static/.keep %{python3_sitelib}/%{pypi_name} %changelog +* Tue Jul 25 2023 Mamoru TASAKA - 2.3.0-11 +- Backport upstream patch for Jinja2 3.1 change + * Tue Jul 25 2023 Mamoru TASAKA - 2.3.0-10 - Backport upstream patch for python 3.12 SafeConfigParser removal