forked from NixOS/nixpkgs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Before this it didn't find the correct files. Unfortunately, the interactive parts of sage are hard to test automatically.
- Loading branch information
Showing
4 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
pkgs/applications/science/math/sage/patches/threejs-offline.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
diff --git a/build/pkgs/threejs/spkg-src b/build/pkgs/threejs/spkg-src | ||
index 91780d813c..254b850a24 100755 | ||
--- a/build/pkgs/threejs/spkg-src | ||
+++ b/build/pkgs/threejs/spkg-src | ||
@@ -20,9 +20,17 @@ URL3="https://raw.githubusercontent.com/mrdoob/three.js/${GIT_VERSION}/LICENSE" | ||
echo "Downloading $URL3" | ||
curl -OL "$URL3" | ||
|
||
+# Set up directory structure | ||
+ | ||
+mkdir build | ||
+mv three.min.js build | ||
+ | ||
+mkdir -p examples/js/controls | ||
+mv OrbitControls.js examples/js/controls | ||
+ | ||
# Package | ||
-tar czf "$SAGE_ROOT/upstream/threejs-${GIT_VERSION}.tar.gz" 'three.min.js' 'OrbitControls.js' 'LICENSE' | ||
-rm -rf 'three.min.js' 'OrbitControls.js' 'LICENSE' | ||
+tar czf "$SAGE_ROOT/upstream/threejs-${GIT_VERSION}.tar.gz" build examples 'LICENSE' | ||
+rm -rf 'build' 'examples' 'LICENSE' | ||
|
||
# Update package info | ||
echo "${GIT_VERSION}" > 'package-version.txt' | ||
diff --git a/src/sage/repl/rich_output/backend_ipython.py b/src/sage/repl/rich_output/backend_ipython.py | ||
index 7c27d48a21..8bf4861a35 100644 | ||
--- a/src/sage/repl/rich_output/backend_ipython.py | ||
+++ b/src/sage/repl/rich_output/backend_ipython.py | ||
@@ -411,10 +411,15 @@ class BackendIPythonCommandline(BackendIPython): | ||
sage: backend.threejs_offline_scripts() | ||
'...<script ...</script>...' | ||
""" | ||
- from sage.env import SAGE_SHARE | ||
+ from sage.env import THREEJS_DIR | ||
|
||
- scripts = [os.path.join(SAGE_SHARE, 'threejs', script) | ||
- for script in ['three.min.js', 'OrbitControls.js']] | ||
+ scripts = [ | ||
+ os.path.join(THREEJS_DIR, script) | ||
+ for script in [ | ||
+ 'build/three.min.js', | ||
+ 'examples/js/controls/OrbitControls.js', | ||
+ ] | ||
+ ] | ||
|
||
if sys.platform == 'cygwin': | ||
import cygwin | ||
@@ -594,13 +599,13 @@ class BackendIPythonNotebook(BackendIPython): | ||
sage: from sage.repl.rich_output.backend_ipython import BackendIPythonNotebook | ||
sage: backend = BackendIPythonNotebook() | ||
sage: backend.threejs_offline_scripts() | ||
- '...<script src="/nbextensions/threejs/three.min...<\\/script>...' | ||
+ '...<script src="/nbextensions/threejs/build/three.min...<\\/script>...' | ||
""" | ||
from sage.repl.rich_output import get_display_manager | ||
CDN_scripts = get_display_manager().threejs_scripts(online=True) | ||
return """ | ||
-<script src="/nbextensions/threejs/three.min.js"></script> | ||
-<script src="/nbextensions/threejs/OrbitControls.js"></script> | ||
+<script src="/nbextensions/threejs/build/three.min.js"></script> | ||
+<script src="/nbextensions/threejs/examples/js/controls/OrbitControls.js"></script> | ||
<script> | ||
if ( !window.THREE ) document.write('{}'); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters