mirror of https://github.com/pyodide/pyodide.git
Install uglifyjs and lessc via npm (#1002)
The installation is very fast, and this avoids having two copies of node around. In particular, this avoids the need to monkey-patch uglify-js to use the system node. This can be further streamlined when #792 is merged
This commit is contained in:
parent
4e39fd39d6
commit
4ae245855d
|
@ -3,7 +3,7 @@ version: 2
|
|||
defaults: &defaults
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: iodide/pyodide-env:9
|
||||
- image: iodide/pyodide-env:10
|
||||
environment:
|
||||
- EMSDK_NUM_CORES: 4
|
||||
EMCC_CORES: 4
|
||||
|
|
|
@ -12,6 +12,7 @@ firefox/
|
|||
.vscode
|
||||
.idea
|
||||
.mypy_cache/
|
||||
node_modules/
|
||||
|
||||
build
|
||||
downloads
|
||||
|
|
|
@ -3,14 +3,10 @@ FROM python:3.8.2-buster
|
|||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
# building packages
|
||||
bzip2 ccache clang-format-6.0 cmake f2c g++ gfortran libtinfo5 node-less swig uglifyjs \
|
||||
bzip2 ccache clang-format-6.0 cmake f2c g++ gfortran libtinfo5 swig \
|
||||
# testing packages: libgconf-2-4 is necessary for running chromium
|
||||
libgconf-2-4 chromium \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& test "Comment: Hardcode nodejs path for uglifyjs, so it doesn't conflict with emcc's nodejs" \
|
||||
&& test $(which node) = /usr/bin/node && test $(which uglifyjs) = /usr/bin/uglifyjs \
|
||||
&& echo '#!/bin/sh -e\nexec /usr/bin/node /usr/bin/uglifyjs "$@"' >/tmp/uglifyjs \
|
||||
&& chmod a+x /tmp/uglifyjs && mv -t /usr/local/bin /tmp/uglifyjs
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN pip3 --no-cache-dir install pytest pytest-xdist pytest-instafail pytest-rerunfailures \
|
||||
pytest-httpserver pytest-cov selenium PyYAML flake8 black distlib mypy "Cython<3.0"
|
||||
|
|
12
Makefile
12
Makefile
|
@ -3,6 +3,8 @@ include Makefile.envs
|
|||
.PHONY=check
|
||||
|
||||
FILEPACKAGER=$(PYODIDE_ROOT)/emsdk/emsdk/fastcomp/emscripten/tools/file_packager.py
|
||||
UGLIFYJS=$(PYODIDE_ROOT)/node_modules/.bin/uglifyjs
|
||||
LESSC=$(PYODIDE_ROOT)/node_modules/.bin/lessc
|
||||
|
||||
CPYTHONROOT=cpython
|
||||
CPYTHONLIB=$(CPYTHONROOT)/installs/python-$(PYVERSION)/lib/python$(PYMINOR)
|
||||
|
@ -94,8 +96,8 @@ build/console.html: src/templates/console.html
|
|||
sed -i -e 's#{{ PYODIDE_BASE_URL }}#$(PYODIDE_BASE_URL)#g' $@
|
||||
|
||||
|
||||
build/renderedhtml.css: src/css/renderedhtml.less
|
||||
lessc $< $@
|
||||
build/renderedhtml.css: src/css/renderedhtml.less $(LESSC)
|
||||
$(LESSC) $< $@
|
||||
|
||||
build/webworker.js: src/webworker.js
|
||||
cp $< $@
|
||||
|
@ -129,6 +131,7 @@ clean:
|
|||
rm -fr root
|
||||
rm -fr build/*
|
||||
rm -fr src/*.bc
|
||||
rm -fr node_modules
|
||||
make -C packages clean
|
||||
make -C packages/six clean
|
||||
make -C packages/jedi clean
|
||||
|
@ -157,9 +160,12 @@ build/test.data: $(CPYTHONLIB)
|
|||
cd build; \
|
||||
python $(FILEPACKAGER) test.data --lz4 --preload ../$(CPYTHONLIB)/test@/lib/python3.8/test --js-output=test.js --export-name=pyodide._module --exclude __pycache__ \
|
||||
)
|
||||
uglifyjs build/test.js -o build/test.js
|
||||
$(UGLIFYJS) build/test.js -o build/test.js
|
||||
|
||||
|
||||
$(UGLIFYJS) $(LESSC): emsdk/emsdk/.complete
|
||||
npm i --no-save uglify-js lessc
|
||||
|
||||
root/.built: \
|
||||
$(CPYTHONLIB) \
|
||||
$(SIX_LIBS) \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export EMSCRIPTEN_VERSION = 1.38.44
|
||||
export BINARYEN_VERSION = version_86
|
||||
|
||||
export PATH := $(PYODIDE_ROOT)/ccache:$(PYODIDE_ROOT)/emsdk/emsdk:$(PYODIDE_ROOT)/emsdk/emsdk/node/12.18.1_64bit/bin:$(PYODIDE_ROOT)/emsdk/emsdk/binaryen/bin/:$(PYODIDE_ROOT)/emsdk/emsdk/fastcomp/emscripten/:$(PATH)
|
||||
export PATH := $(PYODIDE_ROOT)/ccache:$(PYODIDE_ROOT)/emsdk/emsdk:$(PYODIDE_ROOT)/emsdk/emsdk/node/12.18.1_64bit/bin:$(PYODIDE_ROOT)/emsdk/emsdk/binaryen/bin/:$(PYODIDE_ROOT)/emsdk/emsdk/fastcomp/emscripten/:$(PYODIDE_ROOT)/node_modules/.bin/:$(PATH)
|
||||
|
||||
export EMSDK = $(PYODIDE_ROOT)/emsdk/emsdk
|
||||
export EM_CONFIG = $(PYODIDE_ROOT)/emsdk/emsdk/.emscripten
|
||||
|
|
|
@ -19,8 +19,6 @@ Additional build prerequisites are:
|
|||
- PyYAML
|
||||
- FreeType 2 development libraries to compile Matplotlib.
|
||||
- Cython to compile SciPy
|
||||
- [lessc](http://lesscss.org/) to compile less to css.
|
||||
- [uglifyjs](https://github.com/mishoo/UglifyJS) to minify Javascript builds.
|
||||
- gfortran (GNU Fortran 95 compiler)
|
||||
- [f2c](http://www.netlib.org/f2c/)
|
||||
- [ccache](https://ccache.samba.org) (optional) *highly* recommended for much faster rebuilds.
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
### Added
|
||||
- `micropip` now supports installing wheels from relative urls. [#872](https://github.com/iodide-project/pyodide/pull/872)
|
||||
- uglifyjs and lessc no longer need to be installed in the system during build
|
||||
|
||||
## Version 0.16.1
|
||||
*December 25, 2020*
|
||||
|
|
|
@ -26,7 +26,7 @@ function error() {
|
|||
}
|
||||
|
||||
|
||||
PYODIDE_IMAGE_TAG="9"
|
||||
PYODIDE_IMAGE_TAG="10"
|
||||
PYODIDE_PREBUILT_IMAGE_TAG="0.16.0b1"
|
||||
DEFAULT_PYODIDE_DOCKER_IMAGE="iodide/pyodide-env:${PYODIDE_IMAGE_TAG}"
|
||||
DEFAULT_PYODIDE_SYSTEM_PORT="8000"
|
||||
|
|
|
@ -37,11 +37,6 @@ check_fortran_dependencies() {
|
|||
check_binary_present "f2c"
|
||||
}
|
||||
|
||||
check_js_dependencies() {
|
||||
check_binary_present "lessc"
|
||||
check_binary_present "uglifyjs"
|
||||
}
|
||||
|
||||
check_pyyaml() {
|
||||
local pyyaml_import_check
|
||||
pyyaml_import_check="$(python3 -c 'import yaml' 2>&1)"
|
||||
|
@ -54,5 +49,4 @@ check_python_version
|
|||
check_pkgconfig
|
||||
#check_python_headers
|
||||
check_fortran_dependencies
|
||||
check_js_dependencies
|
||||
check_pyyaml
|
||||
|
|
Loading…
Reference in New Issue