aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/matplotlib/py3/patches/01-arcadia.patch
diff options
context:
space:
mode:
authorzverevgeny <zverevgeny@yandex-team.com>2025-05-13 19:00:02 +0300
committerzverevgeny <zverevgeny@yandex-team.com>2025-05-13 19:13:54 +0300
commit92e06374736aa28637dc0e706455b65c8268a5e6 (patch)
tree3df370c199ae25d308e542f02af20f43eab78f8a /contrib/python/matplotlib/py3/patches/01-arcadia.patch
parentdc63d5794da99c2ebe3f32914d0351d9707660b0 (diff)
downloadydb-92e06374736aa28637dc0e706455b65c8268a5e6.tar.gz
Import matplotlib
commit_hash:d59c2338025ef8fd1e1f961ed9d8d5fd52d0bd96
Diffstat (limited to 'contrib/python/matplotlib/py3/patches/01-arcadia.patch')
-rw-r--r--contrib/python/matplotlib/py3/patches/01-arcadia.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/contrib/python/matplotlib/py3/patches/01-arcadia.patch b/contrib/python/matplotlib/py3/patches/01-arcadia.patch
new file mode 100644
index 00000000000..ff2be0382b3
--- /dev/null
+++ b/contrib/python/matplotlib/py3/patches/01-arcadia.patch
@@ -0,0 +1,53 @@
+--- contrib/python/matplotlib/py3/matplotlib/__init__.py (index)
++++ contrib/python/matplotlib/py3/matplotlib/__init__.py (working tree)
+@@ -529,1 +529,1 @@ def _get_data_path():
+- return str(Path(__file__).with_name("mpl-data"))
++ return _get_internal_mpl_data()
+@@ -530,4 +530,18 @@ def get_cachedir():
+
+
++def _get_internal_mpl_data():
++ import tempfile
++ import __res
++
++ tmp_dir = tempfile.mkdtemp(prefix='mpl-temp', dir=tempfile.gettempdir())
++ for key, rel_path in __res.iter_keys(b"resfs/file/contrib/python/matplotlib/py3/matplotlib/mpl-data/"):
++ filename = f"{tmp_dir}/{str(rel_path, 'ascii')}"
++ os.makedirs(os.path.dirname(filename), exist_ok=True)
++ with open(filename, 'wb') as f:
++ f.write(__res.find(key))
++
++ return tmp_dir
++
++
+ def matplotlib_fname():
+ """
+--- contrib/python/matplotlib/py3/matplotlib/backends/backend_nbagg.py (index)
++++ contrib/python/matplotlib/py3/matplotlib/backends/backend_nbagg.py (working tree)
+@@ -111,9 +111,9 @@ class FigureManagerNbAgg(FigureManagerWebAgg):
+ else:
+ output = stream
+ super().get_javascript(stream=output)
+- output.write((pathlib.Path(__file__).parent
+- / "web_backend/js/nbagg_mpl.js")
+- .read_text(encoding="utf-8"))
++ import pkgutil
++ data = pkgutil.get_data(__package__, "web_backend/js/nbagg_mpl.js").decode("utf-8")
++ output.write(data)
+ if stream is None:
+ return output.getvalue()
+
+--- contrib/python/matplotlib/py3/matplotlib/backends/backend_webagg_core.py (index)
++++ contrib/python/matplotlib/py3/matplotlib/backends/backend_webagg_core.py (working tree)
+@@ -505,8 +505,9 @@ class FigureManagerWebAgg(backend_bases.FigureManagerBase):
+ else:
+ output = stream
+
+- output.write((Path(__file__).parent / "web_backend/js/mpl.js")
+- .read_text(encoding="utf-8"))
++ import pkgutil
++ data = pkgutil.get_data(__package__, "web_backend/js/mpl.js").decode("utf-8")
++ output.write(data)
+
+ toolitems = []
+ for name, tooltip, image, method in cls.ToolbarCls.toolitems: