Skip to content

Commit 14a228f

Browse files
author
Release Manager
committed
gh-37178: `sage.features.threejs`: Fix modularization regression after #37024 <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> `sage.features` is shipped by **sagemath-environment**, but the version file that the Feature introduced in #37024 uses is shipped by **sagemath-repl**. This breaks doctesting in a modularized environment. As seen in ipython/ipython#14317 (https://github.com/ipytho n/ipython/actions/runs/7731330166/job/21078723213?pr=14317#step:9:136) <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #37178 Reported by: Matthias Köppe Reviewer(s): Gonzalo Tornaría, Kwankyu Lee, Matthias Köppe
2 parents c5fa076 + a2ce28c commit 14a228f

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/sage/features/threejs.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,22 @@ def __init__(self):
2525
"""
2626
from sage.env import SAGE_SHARE, THREEJS_DIR
2727

28-
version = self.required_version()
29-
3028
threejs_search_path = THREEJS_DIR or (
3129
os.path.join(SAGE_SHARE, "jupyter", "nbextensions", "threejs-sage"),
3230
os.path.join(SAGE_SHARE, "sagemath", "threejs-sage"),
3331
os.path.join(SAGE_SHARE, "sage", "threejs"),
3432
os.path.join(SAGE_SHARE, "threejs-sage")
3533
)
3634

35+
try:
36+
version = self.required_version()
37+
filename = os.path.join(version, "three.min.js")
38+
except FileNotFoundError:
39+
filename = 'unknown'
40+
3741
StaticFile.__init__(
3842
self, name="threejs",
39-
filename=os.path.join(version, "three.min.js"),
43+
filename=filename,
4044
spkg="threejs",
4145
type="standard",
4246
search_path=threejs_search_path,
@@ -46,6 +50,11 @@ def required_version(self):
4650
"""
4751
Return the version of threejs that Sage requires.
4852
53+
Defining what version is required is delegated to the distribution package
54+
that provides the file ``threejs-version.txt`` in :mod:`sage.ext_data.threejs`.
55+
56+
If the file is not provided, :class:`FileNotFoundError` is raised.
57+
4958
EXAMPLES::
5059
5160
sage: from sage.features.threejs import Threejs

0 commit comments

Comments
 (0)