From c8527c5e5e07e130315971a5bbb2b6da34f0d607 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 21 Aug 2018 11:29:14 -0400 Subject: [PATCH 1/2] Don't include full paths in package metadata --- Makefile | 12 +++++++++--- tools/buildpkg.py | 7 ++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4aaf771e5..b5292eaeb 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PYODIDE_ROOT=$(abspath .) include Makefile.envs -FILEPACKAGER=emsdk/emsdk/emscripten/tag-1.38.10/tools/file_packager.py +FILEPACKAGER=$(PYODIDE_ROOT)/emsdk/emsdk/emscripten/tag-1.38.10/tools/file_packager.py CPYTHONROOT=cpython CPYTHONLIB=$(CPYTHONROOT)/installs/python-$(PYVERSION)/lib/python$(PYMINOR) @@ -64,7 +64,10 @@ build/pyodide.asm.js: src/main.bc src/jsimport.bc src/jsproxy.bc src/js2python.b build/pyodide.asm.data: root/.built - python $(FILEPACKAGER) build/pyodide.asm.data --preload root/lib@lib --js-output=build/pyodide.asm.data.js --use-preload-plugins + ( \ + cd build; \ + python $(FILEPACKAGER) pyodide.asm.data --preload ../root/lib@lib --js-output=pyodide.asm.data.js --use-preload-plugins \ + ) uglifyjs build/pyodide.asm.data.js -o build/pyodide.asm.data.js @@ -136,7 +139,10 @@ build/test.data: $(CPYTHONLIB) cd $(CPYTHONLIB)/test; \ find -type d -name __pycache__ -prune -exec rm -rf {} \; \ ) - python $(FILEPACKAGER) build/test.data --preload $(CPYTHONLIB)/test@/lib/python3.6/test --js-output=build/test.js --export-name=pyodide --exclude \*.wasm.pre --exclude __pycache__ + ( \ + cd build; \ + python $(FILEPACKAGER) test.data --preload ../$(CPYTHONLIB)/test@/lib/python3.6/test --js-output=test.js --export-name=pyodide --exclude \*.wasm.pre --exclude __pycache__ \ + ) uglifyjs build/test.js -o build/test.js diff --git a/tools/buildpkg.py b/tools/buildpkg.py index ccc2d4464..1ae1856e9 100755 --- a/tools/buildpkg.py +++ b/tools/buildpkg.py @@ -143,14 +143,15 @@ def package_files(buildpath, srcpath, pkg, args): subprocess.run([ 'python', Path(os.environ['EMSCRIPTEN']) / 'tools' / 'file_packager.py', - buildpath / (name + '.data'), + name + '.data', '--preload', '{}@/lib/python3.6/site-packages'.format(libdir), - '--js-output={}'.format(buildpath / (name + '.js')), + '--js-output={}'.format(name + '.js'), '--export-name=pyodide', '--exclude', '*.wasm.pre', '--exclude', '__pycache__', - '--use-preload-plugins'], check=True) + '--use-preload-plugins'], + cwd=buildpath, check=True) subprocess.run([ 'uglifyjs', buildpath / (name + '.js'), From 3c8bcae56b27be3c664e5ef34b94e959dbb7c06e Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 21 Aug 2018 11:29:36 -0400 Subject: [PATCH 2/2] Don't include full paths in sysconfigdata --- cpython/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpython/Makefile b/cpython/Makefile index dc1a4e3b3..b6c0e613b 100644 --- a/cpython/Makefile +++ b/cpython/Makefile @@ -25,7 +25,8 @@ $(INSTALL)/lib/$(LIB): $(BUILD)/$(LIB) touch $(BUILD)/$(LIB) ; \ emmake make HOSTPYTHON=$(HOSTPYTHON) PYTHON_FOR_BUILD=$(HOSTPYTHON) CROSS_COMPILE=yes inclinstall libinstall $(LIB) && \ cp $(LIB) $(INSTALL)/lib/ && \ - cp $(HOSTINSTALL)/lib/python$(PYMINOR)/`$(HOSTPYTHON) -c "import sysconfig; print(sysconfig._get_sysconfigdata_name())"`.py $(INSTALL)/lib/python$(PYMINOR)/_sysconfigdata__emscripten_.py \ + cp $(HOSTINSTALL)/lib/python$(PYMINOR)/`$(HOSTPYTHON) -c "import sysconfig; print(sysconfig._get_sysconfigdata_name())"`.py $(INSTALL)/lib/python$(PYMINOR)/_sysconfigdata__emscripten_.py; \ + sed -i -e 's#'"$(PYODIDE_ROOT)"'##g' $(INSTALL)/lib/python$(PYMINOR)/_sysconfigdata__emscripten_.py; \ )