File: 00-unminified-js-path.patch

package info (click to toggle)
plotly 5.4.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 90,200 kB
  • sloc: python: 368,793; javascript: 213,159; sh: 49; makefile: 4
file content (33 lines) | stat: -rw-r--r-- 1,010 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Description: Changes path to use plotly offline javascript file.
Author: Josue Ortega <josue@debian.org>
Last-Update: 2019-08-17
Forwarded: not-needed

--- a/plotly/offline/offline.py
+++ b/plotly/offline/offline.py
@@ -6,6 +6,7 @@
 from __future__ import absolute_import
 
 import os
+import sys
 import warnings
 import pkgutil
 import plotly
@@ -86,10 +87,14 @@
     >>> with open('multi_plot.html', 'w') as f:
     ...      f.write(html) # doctest: +SKIP
     """
-    path = os.path.join("package_data", "plotly.min.js")
-    plotlyjs = pkgutil.get_data("plotly", path).decode("utf-8")
-    return plotlyjs
+    def get_debian_plotlyjs():
+        debian_path = '/usr/share/python3-plotly/plotly.js'
+        plotly_js_data = None
+        with open(debian_path, 'r') as file_:
+            plotly_js_data = file_.read()
+        return plotly_js_data.encode('utf-8').decode('utf-8')
 
+    return get_debian_plotlyjs()
 
 def _build_resize_script(plotdivid, plotly_root="Plotly"):
     resize_script = (