Commit 2ca008bb authored by Michael Droettboom's avatar Michael Droettboom Committed by GitHub

Merge pull request #166 from rth/versioning

Add version information
parents 02ce5a4a 59de8d4a
...@@ -77,6 +77,9 @@ jobs: ...@@ -77,6 +77,9 @@ jobs:
- ./pyodide-env - ./pyodide-env
- ./firefox - ./firefox
- store_artifacts:
path: /home/circleci/repo/build/
test-firefox: test-firefox:
<<: *defaults <<: *defaults
steps: steps:
...@@ -111,9 +114,6 @@ jobs: ...@@ -111,9 +114,6 @@ jobs:
export PATH=$PWD/firefox:$PATH export PATH=$PWD/firefox:$PATH
pytest test -v -k chrome pytest test -v -k chrome
- store_artifacts:
path: /home/circleci/repo/build/
deploy: deploy:
machine: machine:
enabled: true enabled: true
......
...@@ -7,7 +7,11 @@ git checkout --orphan tmp ...@@ -7,7 +7,11 @@ git checkout --orphan tmp
git add * git add *
git config --global user.email "deploybot@nowhere.com" git config --global user.email "deploybot@nowhere.com"
git config --global user.name "Deploybot" git config --global user.name "Deploybot"
git commit -m "Deployed from Circle-CI $CIRCLE_BUILD_NUM" git commit -m << END
Deployed from Circle-CI $CIRCLE_BUILD_NUM
Version $(git describe --tags --always)
END
git checkout master git checkout master
git reset --hard tmp git reset --hard tmp
git push origin -f master git push origin -f master
...@@ -160,6 +160,11 @@ root/.built: \ ...@@ -160,6 +160,11 @@ root/.built: \
cp src/_testcapi.py root/lib/python$(PYMINOR) cp src/_testcapi.py root/lib/python$(PYMINOR)
cp src/pystone.py root/lib/python$(PYMINOR) cp src/pystone.py root/lib/python$(PYMINOR)
cp src/pyodide.py root/lib/python$(PYMINOR)/site-packages 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; \
fi
( \ ( \
cd root/lib/python$(PYMINOR); \ cd root/lib/python$(PYMINOR); \
rm -fr `cat ../../../remove_modules.txt`; \ rm -fr `cat ../../../remove_modules.txt`; \
......
...@@ -48,7 +48,7 @@ main(int argc, char** argv) ...@@ -48,7 +48,7 @@ main(int argc, char** argv)
if (js2python_init() || JsImport_init() || JsProxy_init() || if (js2python_init() || JsImport_init() || JsProxy_init() ||
pyimport_init() || pyproxy_init() || python2js_init() || pyimport_init() || pyproxy_init() || python2js_init() ||
runpython_init_js() || runpython_init_py()) { runpython_init_js() || runpython_init_py() || runpython_finalize_js()) {
return 1; return 1;
} }
......
...@@ -7,6 +7,8 @@ from js import XMLHttpRequest ...@@ -7,6 +7,8 @@ from js import XMLHttpRequest
import ast import ast
import io import io
__version__ = '0.1.0'
def open_url(url): def open_url(url):
""" """
......
...@@ -68,3 +68,12 @@ runpython_init_py() ...@@ -68,3 +68,12 @@ runpython_init_py()
Py_DECREF(d); Py_DECREF(d);
return 0; return 0;
} }
EM_JS(int, runpython_finalize_js, (), {
Module.version = function()
{
Module.runPython("import pyodide");
return Module.runPython("pyodide.__version__");
};
return 0;
});
...@@ -10,4 +10,7 @@ runpython_init_js(); ...@@ -10,4 +10,7 @@ runpython_init_js();
int int
runpython_init_py(); runpython_init_py();
int
runpython_finalize_js();
#endif /* RUNPYTHON_H */ #endif /* RUNPYTHON_H */
...@@ -2,7 +2,6 @@ import os ...@@ -2,7 +2,6 @@ import os
from pathlib import Path from pathlib import Path
import time import time
import pytest import pytest
...@@ -391,3 +390,19 @@ def test_load_package_after_convert_string(selenium): ...@@ -391,3 +390,19 @@ def test_load_package_after_convert_string(selenium):
selenium.load_package('kiwisolver') selenium.load_package('kiwisolver')
selenium.run( selenium.run(
"import kiwisolver") "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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment