Commit 4299c078 authored by Boxiang Sun's avatar Boxiang Sun

pyodide amending

parent bbd57ae1
......@@ -2,6 +2,7 @@
# slaposcookbook_recipe_location = ${:parts-directory}/slaposcookbook
extends =
../curl/buildout.cfg
../git/buildout.cfg
../python3/buildout.cfg
../ccache/buildout.cfg
......@@ -9,7 +10,6 @@ extends =
../wget/buildout.cfg
../tar/buildout.cfg
../libyaml/buildout.cfg
../libqhull/buildout.cfg
../python-PyYAML/buildout.cfg
../cmake/buildout.cfg
../bzip2/buildout.cfg
......@@ -59,21 +59,6 @@ repository = https://lab.nexedi.com/Daetalus/pyodide.git
location = ${buildout:parts-directory}/${:_buildout_section_name_}
branch = master
[pytest]
recipe = zc.recipe.egg:custom
egg = pytest
eggs =
python-setuptools
py
six
attrs
funcsigs
pathlib2
pluggy
atomicwrites
more-itertools
pytest-instafail
[pyodide-script]
recipe = slapos.recipe.build
location = ${buildout:parts-directory}/${:_buildout_section_name_}
......@@ -83,7 +68,7 @@ git-executable = ${git:location}/bin/git
emsdk_set_env_script = ${:build_dir}/emsdk/emsdk/emsdk_set_env.sh
repository = https://lab.nexedi.com/Daetalus/pyodide.git
PKG_CONFIG_PATH=${freetype:location}/lib/pkgconfig:${zlib:location}/lib/pkgconfig:${libpng:location}/lib/pkgconfig
PATH=${git:location}/bin:${pkgconfig:location}/bin:${freetype:location}/bin:${nodejs:location}/bin/:${f2c:location}/bin:${python3.7.2:location}/bin:${cmake:location}/bin:${ccache:location}/bin:${gcc-8.2:location}/bin:${node-less:location}/node_modules/.bin:${node-uglify-js:location}/node_modules/.bin:${xz-utils:location}/bin
PATH=${curl:location}/bin:${git:location}/bin:${pkgconfig:location}/bin:${freetype:location}/bin:${nodejs:location}/bin/:${f2c:location}/bin:${python3.7.2:location}/bin:${cmake:location}/bin:${ccache:location}/bin:${gcc-8.2:location}/bin:${node-less:location}/node_modules/.bin:${node-uglify-js:location}/node_modules/.bin:${xz-utils:location}/bin
CC=${gcc-8.2:location}/bin/gcc
CXX=${gcc-8.2:location}/bin/g++
CPPFLAGS=-I${f2c:location}/include -I${zlib:location}/include -I${xz-utils:location}/include -I${readline:location}/include -I${libexpat:location}/include -I${libffi:location}/include -I${ncurses:location}/include -I${ncurses:location}/include/ncursesw -I${bzip2:location}/include -I${gdbm:location}/include -I${openssl:location}/include -I${sqlite3:location}/include -I${gettext:location}/include
......@@ -96,15 +81,34 @@ openssl_location = ${openssl:location}
stop-on-error=true
script =
import subprocess, os, shutil
shutil.rmtree(self.options['build_dir'], ignore_errors=True)
env = {
'PKG_CONFIG_PATH':self.options['PKG_CONFIG_PATH'],
'PATH':self.options['PATH'] + ':' + os.environ['PATH'],
'LD_LIBRARY_PATH':self.options['LD_LIBRARY_PATH_EMSDK'],
'C_INCLUDE_PATH':self.options['C_INCLUDE_PATH'],
'PYTHON_EXECUTABLE':self.options['PYTHON_EXECUTABLE'],
'CC':self.options['CC'],
'CXX':self.options['CXX'],
}
if not os.path.isdir(self.options['build_dir']):
command_list_0 = [{'cmd': self.options['git-executable'] + ' clone ' + self.options['repository'] + ' pyodide-script-test', 'cwd': self.options['part_dir']}]
# put the Popen in the loop to let the pipe.wait() work.
for command_0 in command_list_0:
pipe = subprocess.Popen(command_0['cmd'], cwd=command_0['cwd'], env=env, shell=True)
pipe.wait()
# else:
# shutil.rmtree(self.options['build_dir'], ignore_errors=True)
cpython_makefile_command = 'sed -ie "s@./configure --prefix@./configure --with-openssl=' + self.options['openssl_location'] + ' --prefix@" ' + self.options['build_dir'] + '/cpython/Makefile'
disable_package_command = 'rm -rf ' + self.options['build_dir'] + '/packages/'
get_pip = "curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py"
install_pip = "python3 get-pip.py"
install_pytest = "pip install pytest selenium pytest-instafail pytest-timeout"
change_python3_name = 'ln -s ' + self.options['PYTHON_EXECUTABLE'] + 'python3 ' + self.options['PYTHON_EXECUTABLE'] + 'python'
command_list = [
{'cmd': self.options['git-executable'] + ' clone ' + self.options['repository'] + ' pyodide-script-test', 'cwd': self.options['part_dir']},
{'cmd': change_python3_name, 'cwd': self.options['build_dir']},
{'cmd': cpython_makefile_command, 'cwd': self.options['build_dir']},
{'cmd': get_pip, 'cwd': self.options['build_dir']},
......@@ -117,17 +121,9 @@ script =
{'cmd': disable_package_command + 'networkx', 'cwd': self.options['build_dir']},
{'cmd': disable_package_command + 'kiwisolver', 'cwd': self.options['build_dir']},
{'cmd': 'python --version && make -C emsdk', 'cwd': self.options['build_dir']},
{'cmd': 'source ./emsdk/emsdk/emsdk_env.sh', 'cwd': self.options['build_dir']},
{'cmd': 'sleep 5', 'cwd': self.options['build_dir']},
{'cmd': './emsdk/emsdk/emsdk_env.sh', 'cwd': self.options['build_dir']},
]
env = {
'PKG_CONFIG_PATH':self.options['PKG_CONFIG_PATH'],
'PATH':self.options['PATH'] + ':' + os.environ['PATH'],
'LD_LIBRARY_PATH':self.options['LD_LIBRARY_PATH_EMSDK'],
'C_INCLUDE_PATH':self.options['C_INCLUDE_PATH'],
'PYTHON_EXECUTABLE':self.options['PYTHON_EXECUTABLE'],
'CC':self.options['CC'],
'CXX':self.options['CXX'],
}
for command in command_list:
pipe = subprocess.Popen(command['cmd'], cwd=command['cwd'], env=env, shell=True)
......
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