Skip to content

Commit

Permalink
sagemathgh-37178: sage.features.threejs: Fix modularization regress…
Browse files Browse the repository at this point in the history
…ion after sagemath#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 sagemath#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 sagemath#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 sagemath#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
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37178
Reported by: Matthias Köppe
Reviewer(s): Gonzalo Tornaría, Kwankyu Lee, Matthias Köppe
  • Loading branch information
Release Manager committed Feb 25, 2024
2 parents a846603 + a2ce28c commit 923d13e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/sage/features/threejs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,22 @@ def __init__(self):
"""
from sage.env import SAGE_SHARE, THREEJS_DIR

version = self.required_version()

threejs_search_path = THREEJS_DIR or (
os.path.join(SAGE_SHARE, "jupyter", "nbextensions", "threejs-sage"),
os.path.join(SAGE_SHARE, "sagemath", "threejs-sage"),
os.path.join(SAGE_SHARE, "sage", "threejs"),
os.path.join(SAGE_SHARE, "threejs-sage")
)

try:
version = self.required_version()
filename = os.path.join(version, "three.min.js")
except FileNotFoundError:
filename = 'unknown'

StaticFile.__init__(
self, name="threejs",
filename=os.path.join(version, "three.min.js"),
filename=filename,
spkg="threejs",
type="standard",
search_path=threejs_search_path,
Expand All @@ -46,6 +50,11 @@ def required_version(self):
"""
Return the version of threejs that Sage requires.
Defining what version is required is delegated to the distribution package
that provides the file ``threejs-version.txt`` in :mod:`sage.ext_data.threejs`.
If the file is not provided, :class:`FileNotFoundError` is raised.
EXAMPLES::
sage: from sage.features.threejs import Threejs
Expand Down

0 comments on commit 923d13e

Please sign in to comment.