Skip to content

Migrate Mathjax detection to meson #40404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions build/pkgs/mathjax/SPKG.rst

This file was deleted.

3 changes: 0 additions & 3 deletions build/pkgs/mathjax/checksums.ini

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/mathjax/distros/conda.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/mathjax/distros/fedora.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/mathjax/distros/gentoo.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/mathjax/distros/opensuse.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/mathjax/distros/repology.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/mathjax/distros/void.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/mathjax/package-version.txt

This file was deleted.

26 changes: 0 additions & 26 deletions build/pkgs/mathjax/spkg-configure.m4

This file was deleted.

2 changes: 0 additions & 2 deletions build/pkgs/mathjax/spkg-install.in

This file was deleted.

34 changes: 0 additions & 34 deletions build/pkgs/mathjax/spkg-src

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/mathjax/type

This file was deleted.

1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,5 @@ src = meson.current_source_dir()

# Submodules
subdir('sage')
subdir('sage_docbuild')
subdir('doc')
1 change: 0 additions & 1 deletion src/sage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
....: cmd += f"s1 = samefile(SAGE_ROOT, '{SAGE_ROOT}');"
sage: cmd += f"s2 = samefile(SAGE_LOCAL, '{SAGE_LOCAL}');"
sage: cmd += "print(s1 and s2);"
sage: out = check_output([sys.executable, "-c", cmd], env=env).decode().strip() # long time

Check failure on line 22 in src/sage/env.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, new)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 730, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 1154, in compile_and_execute exec(compiled, globs) File "<doctest sage.env[8]>", line 1, in <module> out = check_output([sys.executable, "-c", cmd], env=env).decode().strip() # long time ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/subprocess.py", line 466, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/subprocess.py", line 571, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/usr/share/miniconda/envs/sage-dev/bin/python3', '-c', "from sage.all import SAGE_ROOT, SAGE_LOCAL;from os.path import samefile;s1 = samefile(SAGE_ROOT, '/home/runner/work/sage/sage');s2 = samefile(SAGE_LOCAL, '/usr/share/miniconda/envs/sage-dev');print(s1 and s2);"]' returned non-zero exit status 1.
sage: out == "True" # long time

Check failure on line 23 in src/sage/env.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, new)

Failed example:

Failed example:: Exception raised: Traceback (most recent call last): File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 730, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/share/miniconda/envs/sage-dev/lib/python3.12/site-packages/sage/doctest/forker.py", line 1154, in compile_and_execute exec(compiled, globs) File "<doctest sage.env[9]>", line 1, in <module> out == "True" # long time ^^^ NameError: name 'out' is not defined
True

AUTHORS:
Expand Down Expand Up @@ -228,7 +228,6 @@

# installation directories for various packages
JMOL_DIR = var("JMOL_DIR")
MATHJAX_DIR = var("MATHJAX_DIR", join(SAGE_SHARE, "mathjax"))
MTXLIB = var("MTXLIB", join(SAGE_SHARE, "meataxe"))
THREEJS_DIR = var("THREEJS_DIR")
PPLPY_DOCS = var("PPLPY_DOCS", join(SAGE_SHARE, "doc", "pplpy"))
Expand Down
6 changes: 4 additions & 2 deletions src/sage_docbuild/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
from sphinx.util.docutils import SphinxDirective

import sage.version
from sage.env import MATHJAX_DIR, PPLPY_DOCS, SAGE_DOC, SAGE_DOC_SRC
from sage.env import PPLPY_DOCS, SAGE_DOC, SAGE_DOC_SRC
from sage.features.sphinx import JupyterSphinx
from sage.misc.latex_macros import sage_mathjax_macros
from sage.misc.sagedoc import extlinks as extlinks # noqa: PLC0414
from sage.misc.sagedoc_conf import * # Load configuration shared with sage.misc.sphinxify

from .config import MATHJAX_PATH

# ---------------------
# General configuration
# ---------------------
Expand Down Expand Up @@ -550,7 +552,7 @@ def linkcode_resolve(domain, info):
if os.environ.get('SAGE_USE_CDNS', 'no') == 'yes':
mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"
else:
mathjax_path = os.path.join(MATHJAX_DIR, 'tex-chtml.js')
mathjax_path = MATHJAX_PATH

# A list of glob-style patterns that should be excluded when looking for source
# files. They are matched against the source file names relative to the
Expand Down
6 changes: 6 additions & 0 deletions src/sage_docbuild/config.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""
Documentation configuration generated by meson
"""

# MathJax path
MATHJAX_PATH: str = '@MATHJAX_PATH@'
21 changes: 21 additions & 0 deletions src/sage_docbuild/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Check for system-wide MathJax installation
mathjax_path = ''
mathjax_found = false
foreach dir : ['/usr/share/mathjax', '/usr/local/share/mathjax']
if not mathjax_found and fs.is_file(dir / 'tex-chtml.js')
mathjax_path = dir / 'tex-chtml.js'
mathjax_found = true
message('Found MathJax at: ' + dir)
endif
endforeach
if not mathjax_found
mathjax_path = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js'
message('Using CDN MathJax: ' + mathjax_path)
endif
docs_config_data = configuration_data()
docs_config_data.set('MATHJAX_PATH', mathjax_path)
configure_file(
input: 'config.py.in',
output: 'config.py',
configuration: docs_config_data,
)
Loading