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
59de8d4a
Commit
59de8d4a
authored
Sep 14, 2018
by
Roman Yurchak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose version information in javascript
parent
d574047a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
4 deletions
+32
-4
.circleci/deploy.sh
.circleci/deploy.sh
+1
-1
Makefile
Makefile
+2
-1
src/main.c
src/main.c
+1
-1
src/runpython.c
src/runpython.c
+9
-0
src/runpython.h
src/runpython.h
+3
-0
test/test_python.py
test/test_python.py
+16
-1
No files found.
.circleci/deploy.sh
View file @
59de8d4a
...
...
@@ -8,7 +8,7 @@ git add *
git config
--global
user.email
"deploybot@nowhere.com"
git config
--global
user.name
"Deploybot"
git commit
-m
<<
END
Deployed from Circle-CI
$CIRCLE_BUILD_NUM
"
Deployed from Circle-CI
$CIRCLE_BUILD_NUM
Version
$(
git describe
--tags
--always
)
END
...
...
Makefile
View file @
59de8d4a
...
...
@@ -162,7 +162,8 @@ root/.built: \
cp
src/pyodide.py root/lib/python
$(PYMINOR)
/site-packages
if
command
-v
git
>
/dev/null 2>&1
\
&&
git describe
--tags
>
/dev/null 2>&1
;
then
\
sed
-i
"s/__version__ =.*/__version__ = '
$(
shell
git describe --tags
)
'/g"
root/lib/python
$(PYMINOR)
/site-packages/pyodide.py
;
\
sed
-i
"s/__version__ =.*/__version__ = '
$(
shell
git describe --tags
)
'/g"
\
root/lib/python
$(PYMINOR)
/site-packages/pyodide.py
;
\
fi
(
\
cd
root/lib/python
$(PYMINOR)
;
\
...
...
src/main.c
View file @
59de8d4a
...
...
@@ -48,7 +48,7 @@ main(int argc, char** argv)
if
(
js2python_init
()
||
JsImport_init
()
||
JsProxy_init
()
||
pyimport_init
()
||
pyproxy_init
()
||
python2js_init
()
||
runpython_init_js
()
||
runpython_init_py
())
{
runpython_init_js
()
||
runpython_init_py
()
||
runpython_finalize_js
()
)
{
return
1
;
}
...
...
src/runpython.c
View file @
59de8d4a
...
...
@@ -68,3 +68,12 @@ runpython_init_py()
Py_DECREF
(
d
);
return
0
;
}
EM_JS
(
int
,
runpython_finalize_js
,
(),
{
Module
.
version
=
function
()
{
Module
.
runPython
(
"import pyodide"
);
return
Module
.
runPython
(
"pyodide.__version__"
);
};
return
0
;
});
src/runpython.h
View file @
59de8d4a
...
...
@@ -10,4 +10,7 @@ runpython_init_js();
int
runpython_init_py
();
int
runpython_finalize_js
();
#endif
/* RUNPYTHON_H */
test/test_python.py
View file @
59de8d4a
...
...
@@ -2,7 +2,6 @@ import os
from
pathlib
import
Path
import
time
import
pytest
...
...
@@ -391,3 +390,19 @@ def test_load_package_after_convert_string(selenium):
selenium
.
load_package
(
'kiwisolver'
)
selenium
.
run
(
"import kiwisolver"
)
def
test_version_info
(
selenium
):
from
distutils.version
import
LooseVersion
version_py_str
=
selenium
.
run
(
"""
import pyodide
pyodide.__version__
"""
)
version_py
=
LooseVersion
(
version_py_str
)
assert
version_py
>
LooseVersion
(
'0.0.1'
)
version_js_str
=
selenium
.
run_js
(
"return pyodide.version()"
)
version_js
=
LooseVersion
(
version_js_str
)
assert
version_py
==
version_js
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