about summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
authorMauricio Collares <mauricio@collares.org>2022-09-04 19:34:00 -0300
committerMauricio Collares <mauricio@collares.org>2022-09-05 12:42:36 -0300
commit13d2edaa42cf6a3feaa41126d52b3ae04acd1305 (patch)
treef509251568185fe97d6322534a2de16d4c065958 /pkgs/applications/science
parent2da64a81275b68fdad38af669afeda43d401e94b (diff)
sageWithDoc: fix documentation index
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/math/sage/patches/sphinx-fix-matplotlib-css-perms.patch21
-rw-r--r--pkgs/applications/science/math/sage/sage-src.nix4
2 files changed, 25 insertions, 0 deletions
diff --git a/pkgs/applications/science/math/sage/patches/sphinx-fix-matplotlib-css-perms.patch b/pkgs/applications/science/math/sage/patches/sphinx-fix-matplotlib-css-perms.patch
new file mode 100644
index 0000000000000..764ecffa23772
--- /dev/null
+++ b/pkgs/applications/science/math/sage/patches/sphinx-fix-matplotlib-css-perms.patch
@@ -0,0 +1,21 @@
+diff --git a/src/sage_docbuild/ext/multidocs.py b/src/sage_docbuild/ext/multidocs.py
+index f91c7753ca..edeb81ff2e 100644
+--- a/src/sage_docbuild/ext/multidocs.py
++++ b/src/sage_docbuild/ext/multidocs.py
+@@ -284,6 +284,16 @@ def init_subdoc(app):
+         if not app.config.multidoc_first_pass:
+             app.connect('env-updated', fetch_citation)
+ 
++            def fix_matplotlib_css_permissions(app: Sphinx, env):
++                css_file = os.path.join(app.builder.outdir, '_static', 'plot_directive.css')
++                try:
++                    os.chmod(css_file, 0o644)
++                except:
++                    pass
++
++            # executed after matplotlib's _copy_css_file
++            app.connect('build-finished', fix_matplotlib_css_permissions, priority=600)
++
+         # Monkey patch copy_static_files to make a symlink to "../"
+         def link_static_files():
+             """
diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix
index 514cbb66ea7d0..8da3c0358f45b 100644
--- a/pkgs/applications/science/math/sage/sage-src.nix
+++ b/pkgs/applications/science/math/sage/sage-src.nix
@@ -81,6 +81,10 @@ stdenv.mkDerivation rec {
     # Parallelize docubuild using subprocesses, fixing an isolation issue. See
     # https://groups.google.com/forum/#!topic/sage-packaging/YGOm8tkADrE
     ./patches/sphinx-docbuild-subprocesses.patch
+
+    # Docbuilding copies files from the Nix store and expects them to be writable.
+    # Remove when https://github.com/matplotlib/matplotlib/pull/23805 lands.
+    ./patches/sphinx-fix-matplotlib-css-perms.patch
   ];
 
   # Since sage unfortunately does not release bugfix releases, packagers must