Commit e05d4fff authored by Boxiang Sun's avatar Boxiang Sun

Amend the pyodide buildout

parent de93102f
......@@ -33,6 +33,7 @@ extends =
parts =
pyodide
pyodide-script-test
nodejs
npm
python3.7.2-PyYAML
......@@ -58,6 +59,21 @@ 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_}
......@@ -71,43 +87,49 @@ PATH=${git:location}/bin:${pkgconfig:location}/bin:${freetype:location}/bin:${no
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
LD_LIBRARY_PATH_EMSDK=${gcc-8.2:location}/lib:${gcc-8.2:location}/lib64
LD_LIBRARY_PATH_EMSDK=${gcc-8.2:location}/lib64:${gcc-8.2:location}/lib
LD_LIBRARY_PATH=${libpng:location}/lib:${openssl:location}/lib:${readline:location}/lib:${libexpat:location}/lib:${xz-utils:location}/lib:${sqlite3:location}/lib:${gdbm:location}/lib:${bzip2:location}/lib:${ncurses:location}/lib:${libffi:location}/lib
LDFLAGS=-L${zlib:location}/lib -L${xz-utils:location}/lib -L${readline:location}/lib -L${libexpat:location}/lib -L${libffi:location}/lib -L${ncurses:location}/lib -L${bzip2:location}/lib -L${gdbm:location}/lib -L${openssl:location}/lib -L${sqlite3:location}/lib -Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${xz-utils:location}/lib -Wl,-rpath=${readline:location}/lib -Wl,-rpath=${libexpat:location}/lib -Wl,-rpath=${libffi:location}/lib -Wl,-rpath=${ncurses:location}/lib -Wl,-rpath=${bzip2:location}/lib -Wl,-rpath=${gdbm:location}/lib -Wl,-rpath=${openssl:location}/lib -Wl,-rpath=${sqlite3:location}/lib -L${gettext:location}/lib -Wl,-rpath=${gettext:location}/lib -Wl,-rpath=${file:location}/lib
PYTHON_EXECUTABLE=${python3.7.2:location}/bin/
C_INCLUDE_PATH=/srv/slapgrid/slappart19/srv/runner/software/100608c416350c3c5f1f11bde4d11d82/parts/gcc-8.2/include:
C_INCLUDE_PATH=${gcc-8.2:location}/include:
openssl_location = ${openssl:location}
stop-on-error=true
script =
import subprocess, os, shutil
# shutil.rmtree(self.options['build_dir'], ignore_errors=True)
# os.mkdir(self.options['location'])
# call(['rm -rf', self.options['location']], cwd=self.options['part_dir'])
#call(['mkdir', self.options['location'])
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': 'python --version && make -C emsdk', 'cwd': self.options['build_dir']},
{'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']},
{'cmd': install_pip, 'cwd': self.options['build_dir']},
{'cmd': install_pytest, 'cwd': self.options['build_dir']},
{'cmd': disable_package_command + 'scipy', 'cwd': self.options['build_dir']},
{'cmd': disable_package_command + 'matplotlib', 'cwd': self.options['build_dir']},
{'cmd': disable_package_command + 'scikit-learn', 'cwd': self.options['build_dir']},
{'cmd': disable_package_command + 'pandas', 'cwd': self.options['build_dir']},
{'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']},
]
env = {
'PKG_CONFIG_PATH':self.options['PKG_CONFIG_PATH'],
'PATH':self.options['PATH'] + ':' + os.environ['PATH'],
# 'CPPFLAGS':self.options['CPPFLAGS'],
'LD_LIBRARY_PATH':self.options['LD_LIBRARY_PATH_EMSDK'],
'C_INCLUDE_PATH':self.options['C_INCLUDE_PATH'],
# 'LDFLAGS':self.options['LDFLAGS'],
'PYTHON_EXECUTABLE':self.options['PYTHON_EXECUTABLE'],
'CC':self.options['CC'],
'CXX':self.options['CXX'],
}
for command in command_list:
print(command['cmd'])
print('1')
pipe = subprocess.Popen(command['cmd'], cwd=command['cwd'], env=env, shell=True)
pipe.wait()
......@@ -130,41 +152,30 @@ script =
env['LD_LIBRARY_PATH'] += ':' + self.options['LD_LIBRARY_PATH']
env['LDFLAGS'] = self.options['LDFLAGS']
print("Merged environment:")
print("Merged environment:")
print("Merged environment:")
print(env)
command_list_2 = [
{'cmd': 'make -C cpython', 'cwd': self.options['build_dir']},
# make -C CPLAPACK twice, because the first time will report can not find the file './a.out'
# call make again, the problem gone...
{'cmd': 'make build/pyodide.asm.js;,'cwd': self.options['build_dir']},
{'cmd': 'make -C CPLAPACK', 'cwd': self.options['build_dir']},
{'cmd': 'make -C CPLAPACK', 'cwd': self.options['build_dir']},
# black magic: Try to compile matplot and scipy, scikit-leanr, pandas lib manually
# error happened in here
{'cmd': 'make -C packages', 'cwd': self.options['build_dir']},
{'cmd': 'make build/pyodide.asm.js', 'cwd': self.options['build_dir']},
{'cmd': 'make -C CLAPACK', 'cwd': self.options['build_dir']},
{'cmd': 'sleep 5', 'cwd': self.options['build_dir']},
{'cmd': 'make -C CLAPACK', 'cwd': self.options['build_dir']},
{'cmd': 'make -C packages', 'cwd': self.options['build_dir']},
{'cmd': 'make build/pyodide.asm.data', 'cwd': self.options['build_dir']},
{'cmd': 'make build/pyodide.js', 'cwd': self.options['build_dir']},
{'cmd': 'make build/pyodide_dev.js', 'cwd': self.options['build_dir']},
{'cmd': 'make build/python.html', 'cwd': self.options['build_dir']},
{'cmd': 'make build/python_dev.html', 'cwd': self.options['build_dir']},
{'cmd': 'make build/test.data', 'cwd': self.options['build_dir']},
{'cmd': 'make build/packages.json', 'cwd': self.options['build_dir']},
{'cmd': 'make build/test.html', 'cwd': self.options['build_dir']},
{'cmd': 'cp -r ./* ../pyodide', 'cwd': self.options['build_dir']},
]
for command_2 in command_list_2:
pipe = subprocess.Popen(command_2['cmd'], cwd=command_2['cwd'], env=env, shell=True)
pipe.wait()
# clean the LDFLAGS and LD_LIBRARY_PATH, otherwise the matplotlib qhull will get trucated object file.
env['LDFLAGS'] = ''
env['LD_LIBRARY_PATH'] = ''
command_list_3 = [
{'cmd': 'make -C packages', 'cwd': self.options['build_dir']},
{'cmd': 'make -e', 'cwd': self.options['build_dir']},
]
for command_3 in command_list_3:
pipe = subprocess.Popen(command_3['cmd'], cwd=command_3['cwd'], env=env, shell=True)
pipe.wait()
for i in range(10):
print("Hello World")
[python3.7.2-PyYAML]
recipe = slapos.recipe.cmmi
python_bin = ${python3.7.2:location}/bin/python3.7
......
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