Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
8875c17b
Commit
8875c17b
authored
Apr 06, 2018
by
Michael Droettboom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix URLs so remote loading works
parent
093a0225
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
Makefile
Makefile
+8
-1
src/pyodide.js
src/pyodide.js
+5
-7
No files found.
Makefile
View file @
8875c17b
...
...
@@ -32,7 +32,7 @@ NUMPY_LIBS=\
SITEPACKAGES
=
root/lib/python
$(PYMINOR)
/site-packages
all
:
build/pyodide.asm.html build/pyodide.js
all
:
build/pyodide.asm.html build/pyodide.js
build/pyodide_dev.js
build/pyodide.asm.html
:
src/main.bc src/jsimport.bc src/jsproxy.bc src/js2python.bc
\
...
...
@@ -41,10 +41,17 @@ build/pyodide.asm.html: src/main.bc src/jsimport.bc src/jsproxy.bc src/js2python
[
-d
build
]
||
mkdir
build
$(CC)
-s
EXPORT_NAME
=
"'pyodide'"
--bind
-o
$@
$(
filter
%.bc,
$^
)
$(LDFLAGS)
\
$(
foreach
d,
$(
wildcard
root/
*
)
,--preload-file
$d
@/
$(
notdir
$d
))
sed
-i
-e
"s#REMOTE_PACKAGE_BASE = 'pyodide.asm.data'#REMOTE_PACKAGE_BASE = pyodide.baseURL + 'pyodide.asm.data'#g"
build/pyodide.asm.js
build/pyodide_dev.js
:
src/pyodide.js
cp
$<
$@
sed
-i
-e
"s#{{DEPLOY}}##g"
$@
build/pyodide.js
:
src/pyodide.js
cp
$<
$@
sed
-i
-e
's#{{DEPLOY}}#https://iodide-project.github.io/pyodide-demo/#g'
$@
build/test.html
:
src/test.html
...
...
src/pyodide.js
View file @
8875c17b
var
pyodide
=
{}
{
let
wasmURL
=
'
pyodide.asm.wasm
'
;
let
baseURL
=
"
{{DEPLOY}}
"
;
let
wasmURL
=
baseURL
+
'
pyodide.asm.wasm
'
;
let
wasmXHR
=
new
XMLHttpRequest
();
wasmXHR
.
open
(
'
GET
'
,
wasmURL
,
true
);
wasmXHR
.
responseType
=
'
arraybuffer
'
;
...
...
@@ -9,16 +10,13 @@ var pyodide = {}
if
(
wasmXHR
.
status
===
200
||
wasmXHR
.
status
===
0
)
{
pyodide
.
wasmBinary
=
wasmXHR
.
response
;
}
else
{
var
wasmURLBytes
=
tryParseAsDataURI
(
wasmURL
);
if
(
wasmURLBytes
)
{
pyodide
.
wasmBinary
=
wasmURLBytes
.
buffer
;
}
alert
(
"
Couldn't download the pyodide.asm.wasm binary. Response was
"
+
wasmXHR
.
status
);
}
pyodide
.
baseURL
=
baseURL
;
var
script
=
document
.
createElement
(
'
script
'
);
script
.
src
=
"
pyodide.asm.js
"
;
script
.
src
=
baseURL
+
"
pyodide.asm.js
"
;
document
.
body
.
appendChild
(
script
);
};
wasmXHR
.
send
(
null
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment