diff --git a/.circleci/config.yml b/.circleci/config.yml index ae53d041e86..d5e10f4f5f6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2 defaults: &defaults working_directory: ~/repo docker: - - image: pyodide/pyodide-env:17 + - image: pyodide/pyodide-env:18 environment: - EMSDK_NUM_CORES: 3 EMCC_CORES: 3 diff --git a/.gitignore b/.gitignore index 0a1c3411a68..d50e1a67159 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ build ccache cpython/downloads cpython/installs +cpython/build.log docs/_build/ emsdk/emsdk geckodriver.log diff --git a/Dockerfile b/Dockerfile index 49e6d718f11..82f05619c07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,11 +3,13 @@ FROM python:3.9.5-slim-buster RUN apt-get update \ && apt-get install -y --no-install-recommends \ - # building packages - bzip2 ccache clang-format-6.0 cmake f2c g++ gfortran git make \ - patch pkg-config swig unzip wget xz-utils \ - # testing packages: libgconf-2-4 is necessary for running chromium - libgconf-2-4 "chromium=90.*" \ + # building packages + bzip2 ccache clang-format-6.0 cmake f2c g++ gfortran git make \ + patch pkg-config swig unzip wget xz-utils \ + autoconf autotools-dev automake texinfo dejagnu \ + build-essential prelink autoconf libtool libltdl-dev \ + # testing packages: libgconf-2-4 is necessary for running chromium + libgconf-2-4 "chromium=90.*" \ && rm -rf /var/lib/apt/lists/* RUN pip3 --no-cache-dir install \ diff --git a/Makefile.envs b/Makefile.envs index 7626b57f915..cfd88e3b9b6 100644 --- a/Makefile.envs +++ b/Makefile.envs @@ -42,6 +42,7 @@ export LDFLAGS_BASE=\ -s WASM=1 \ -std=c++14 \ -s LZ4=1 \ + -L $(CPYTHONROOT)/installs/python-$(PYVERSION)/lib/ \ $(EXTRA_LDFLAGS) export CXXFLAGS_BASE= @@ -49,15 +50,16 @@ export CXXFLAGS_BASE= export SIDE_MODULE_LDFLAGS= $(LDFLAGS_BASE) -s SIDE_MODULE=1 export MAIN_MODULE_LDFLAGS= $(LDFLAGS_BASE) -s MAIN_MODULE=1 \ -s EXPORTED_FUNCTIONS='["___cxa_guard_acquire", "__ZNSt3__28ios_base4initEPv", "_main"]' \ - $(CPYTHONROOT)/installs/python-$(PYVERSION)/lib/libpython$(PYMINOR).a \ + -lpython$(PYMINOR) \ + -lffi \ + -lsqlite3 \ + -lbz2 \ + -lstdc++ \ -s TOTAL_MEMORY=20971520 \ -s ALLOW_MEMORY_GROWTH=1 \ --use-preload-plugins \ -s USE_FREETYPE=1 \ -s USE_LIBPNG=1 \ - -L$(wildcard $(CPYTHONROOT)/build/sqlite*/.libs) -lsqlite3 \ - $(wildcard $(CPYTHONROOT)/build/bzip2*/libbz2.a) \ - -lstdc++ \ --memory-init-file 0 \ export SIDE_MODULE_CXXFLAGS = $(CXXFLAGS_BASE) @@ -73,5 +75,6 @@ export MAIN_MODULE_CFLAGS= $(CFLAGS_BASE) \ -I$(PYTHONINCLUDE) + .output_vars: set diff --git a/cpython/Makefile b/cpython/Makefile index 1bf9a417660..c3368af37f0 100644 --- a/cpython/Makefile +++ b/cpython/Makefile @@ -25,8 +25,11 @@ BZIP2TARBALL=$(ROOT)/downloads/bzip2-1.0.2.tar.gz BZIP2BUILD=$(ROOT)/build/bzip2-1.0.2 BZIP2URL=https://sourceware.org/pub/bzip2/bzip2-1.0.2.tar.gz +FFIBUILD=$(ROOT)/build/libffi +LIBFFIREPO=https://github.com/hoodmane/libffi-emscripten +LIBFFI_COMMIT=dd8318b543b92d038da4914fac42d34056a80c7d -all: $(INSTALL)/lib/$(LIB) +all: $(INSTALL)/lib/$(LIB) $(INSTALL)/lib/libffi.a $(INSTALL)/lib/$(LIB): $(BUILD)/$(LIB) remove_modules.txt @@ -86,7 +89,7 @@ $(ZLIBBUILD)/.configured: $(ZLIBTARBALL) touch $@ -$(SQLITEBUILD)/libsqlite3.la: $(SQLITETARBALL) +$(INSTALL)/lib/libsqlite3.a: $(SQLITETARBALL) [ -d $(ROOT)/build ] || (mkdir $(ROOT)/build) tar -C $(ROOT)/build/ -xf $(SQLITETARBALL) # sqlite fails to detect that popen is not available. We have to set it @@ -96,18 +99,30 @@ $(SQLITEBUILD)/libsqlite3.la: $(SQLITETARBALL) emconfigure ./configure CFLAGS="$(PYTHON_CFLAGS)" CPPFLAGS="-DSQLITE_OMIT_POPEN"; \ emmake make -j $${PYODIDE_JOBS:-3}; \ ) + mkdir -p $(INSTALL)/lib/ + cp $(SQLITEBUILD)/.libs/libsqlite3.a $(INSTALL)/lib/libsqlite3.a -$(BZIP2BUILD)/libbz2.a: $(BZIP2TARBALL) +$(INSTALL)/lib/libbz2.a: $(BZIP2TARBALL) [ -d $(ROOT)/build ] || (mkdir $(ROOT)/build) tar -C $(ROOT)/build/ -xf $(BZIP2TARBALL) ( \ cd $(BZIP2BUILD); \ emmake make -j $${PYODIDE_JOBS:-3} CC=emcc CFLAGS="$(PYTHON_CFLAGS) -D_FILE_OFFSET_BITS=64" AR=emar RANLIB=emranlib libbz2.a; \ ) - - -$(BUILD)/Makefile: $(BUILD)/.patched $(ZLIBBUILD)/.configured $(SQLITEBUILD)/libsqlite3.la $(BZIP2BUILD)/libbz2.a + mkdir -p $(INSTALL)/lib + cp $(BZIP2BUILD)/libbz2.a $(INSTALL)/lib/libbz2.a + +$(INSTALL)/lib/libffi.a : + rm -rf $(FFIBUILD) + git clone $(LIBFFIREPO) $(FFIBUILD) --shallow-exclude upstream-base + source $(PYODIDE_ROOT)/emsdk/emsdk/emsdk_env.sh + cd $(FFIBUILD) && git checkout $(LIBFFI_COMMIT) && bash ./build.sh ; make install + cp $(FFIBUILD)/target/include/*.h $(BUILD)/Include/ + mkdir -p $(INSTALL)/lib + cp $(FFIBUILD)/target/lib/libffi.a $(INSTALL)/lib/ + +$(BUILD)/Makefile: $(BUILD)/.patched $(ZLIBBUILD)/.configured $(INSTALL)/lib/libsqlite3.a $(INSTALL)/lib/libbz2.a cp config.site $(BUILD)/ ( \ cd $(BUILD); \ @@ -118,14 +133,17 @@ $(BUILD)/Makefile: $(BUILD)/.patched $(ZLIBBUILD)/.configured $(SQLITEBUILD)/lib --without-pymalloc \ --disable-shared \ --disable-ipv6 \ - --without-gcc \ + --enable-optimizations \ --host=wasm32-unknown-emscripten\ --build=$(shell $(BUILD)/config.guess) \ --prefix=$(INSTALL) ; \ ) -$(BUILD)/$(LIB): $(BUILD)/Makefile Setup.local +$(BUILD)/Modules/Setup.local : Setup.local + cp Setup.local $(BUILD)/Modules/ + +$(BUILD)/$(LIB): $(BUILD)/Makefile $(BUILD)/pyconfig.h $(BUILD)/Modules/Setup.local $(INSTALL)/lib/libffi.a cp Setup.local $(BUILD)/Modules/ cat pyconfig.undefs.h >> $(BUILD)/pyconfig.h ( \ diff --git a/cpython/Setup.local b/cpython/Setup.local index dffed255633..75e2221626c 100644 --- a/cpython/Setup.local +++ b/cpython/Setup.local @@ -18,6 +18,11 @@ _datetime _datetimemodule.c _heapq _heapqmodule.c _json _json.c _csv _csv.c + +CTYPES_FLAGS=-DHAVE_FFI_PREP_CIF_VAR=1 -DHAVE_FFI_PREP_CLOSURE_LOC=1 -DHAVE_FFI_CLOSURE_ALLOC=1 +_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/cfield.c _ctypes/stgdict.c $(CTYPES_FLAGS) +_ctypes_test _ctypes/_ctypes_test.c + unicodedata unicodedata.c _pickle _pickle.c parser parsermodule.c diff --git a/cpython/patches/ctypes-dont-deref-function-pointer.patch b/cpython/patches/ctypes-dont-deref-function-pointer.patch new file mode 100644 index 00000000000..5c648bba5cf --- /dev/null +++ b/cpython/patches/ctypes-dont-deref-function-pointer.patch @@ -0,0 +1,35 @@ +From 3f11694d7587e782530118d176306eeb6eebf5d1 Mon Sep 17 00:00:00 2001 +From: Hood +Date: Wed, 23 Jun 2021 13:47:30 -0700 +Subject: [PATCH] Don't dereference function pointer + +Ctypes thinks that the result of dlsym is a pointer to the function pointer, so +it should call it like `result = (*f)(args)`. Probably this is true for the +native dlsym, but our dlsym returns an index into the indirect call table +"wasmTable", in particular it isn't even aligned like a pointer should be. +This patch fixes it so that it calls it like `result = f(args)` instead. + +--- + Modules/_ctypes/_ctypes.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c +index ceae67e..44f2d76 100644 +--- a/Modules/_ctypes/_ctypes.c ++++ b/Modules/_ctypes/_ctypes.c +@@ -771,7 +771,11 @@ CDataType_in_dll(PyObject *type, PyObject *args) + return NULL; + } + #endif +- return PyCData_AtAddress(type, address); ++ CDataObject *ob = (CDataObject *)GenericPyCData_new(type, NULL, NULL); ++ if (ob == NULL) ++ return NULL; ++ *(void **)ob->b_ptr = address; ++ return (PyObject*)ob; + } + + static const char from_param_doc[] = +-- +2.17.1 + diff --git a/cpython/patches/remove-duplicate-symbols-from-cfield.c.patch b/cpython/patches/remove-duplicate-symbols-from-cfield.c.patch new file mode 100644 index 00000000000..cb523c0087e --- /dev/null +++ b/cpython/patches/remove-duplicate-symbols-from-cfield.c.patch @@ -0,0 +1,49 @@ +From fc3b69f9afa779185a60834cf1817c22706edcd1 Mon Sep 17 00:00:00 2001 +From: Hood +Date: Tue, 22 Jun 2021 20:12:45 -0700 +Subject: [PATCH] Remove duplicate symbols from cfield.c + +These symbols are already defined by libffi. +--- + Modules/_ctypes/cfield.c | 26 -------------------------- + 1 file changed, 26 deletions(-) + +diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c +index 7ebd4ba..7a63ab7 100644 +--- a/Modules/_ctypes/cfield.c ++++ b/Modules/_ctypes/cfield.c +@@ -1635,31 +1635,5 @@ typedef struct _ffi_type + } ffi_type; + */ + +-/* align and size are bogus for void, but they must not be zero */ +-ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID }; +- +-ffi_type ffi_type_uint8 = { 1, 1, FFI_TYPE_UINT8 }; +-ffi_type ffi_type_sint8 = { 1, 1, FFI_TYPE_SINT8 }; +- +-ffi_type ffi_type_uint16 = { 2, 2, FFI_TYPE_UINT16 }; +-ffi_type ffi_type_sint16 = { 2, 2, FFI_TYPE_SINT16 }; +- +-ffi_type ffi_type_uint32 = { 4, INT_ALIGN, FFI_TYPE_UINT32 }; +-ffi_type ffi_type_sint32 = { 4, INT_ALIGN, FFI_TYPE_SINT32 }; +- +-ffi_type ffi_type_uint64 = { 8, LONG_LONG_ALIGN, FFI_TYPE_UINT64 }; +-ffi_type ffi_type_sint64 = { 8, LONG_LONG_ALIGN, FFI_TYPE_SINT64 }; +- +-ffi_type ffi_type_float = { sizeof(float), FLOAT_ALIGN, FFI_TYPE_FLOAT }; +-ffi_type ffi_type_double = { sizeof(double), DOUBLE_ALIGN, FFI_TYPE_DOUBLE }; +- +-#ifdef ffi_type_longdouble +-#undef ffi_type_longdouble +-#endif +- /* This is already defined on OSX */ +-ffi_type ffi_type_longdouble = { sizeof(long double), LONGDOUBLE_ALIGN, +- FFI_TYPE_LONGDOUBLE }; +- +-ffi_type ffi_type_pointer = { sizeof(void *), VOID_P_ALIGN, FFI_TYPE_POINTER }; + + /*---------------- EOF ----------------*/ +-- +2.17.1 + diff --git a/cpython/patches/xfail-core-ctypes-tests-that-don-t-work.patch b/cpython/patches/xfail-core-ctypes-tests-that-don-t-work.patch new file mode 100644 index 00000000000..2022236bdb8 --- /dev/null +++ b/cpython/patches/xfail-core-ctypes-tests-that-don-t-work.patch @@ -0,0 +1,65 @@ +From a4aec920c76ebcb8360350ff0046c7a0c74c0cf2 Mon Sep 17 00:00:00 2001 +From: Hood +Date: Thu, 24 Jun 2021 14:55:10 -0700 +Subject: [PATCH] xfail core ctypes tests that don't work + +PyCode_SetExtra doesn't work and ctypes doesn't seem to work with variadic functions including PyUnicode_FromFormat/ +--- + Lib/test/test_code.py | 7 +++++-- + Lib/test/test_unicode.py | 1 + + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py +index ac3dde7..d91a350 100644 +--- a/Lib/test/test_code.py ++++ b/Lib/test/test_code.py +@@ -389,6 +389,7 @@ if check_impl_detail(cpython=True) and ctypes is not None: + ctypes.c_voidp(100)), 0) + + def test_free_called(self): ++ raise unittest.SkipTest("PyCode_SetExtra is broken") + # Verify that the provided free function gets invoked + # when the code object is cleaned up. + f = self.get_func() +@@ -398,6 +399,7 @@ if check_impl_detail(cpython=True) and ctypes is not None: + self.assertEqual(LAST_FREED, 100) + + def test_get_set(self): ++ raise unittest.SkipTest("PyCode_SetExtra is broken") + # Test basic get/set round tripping. + f = self.get_func() + +@@ -414,6 +416,7 @@ if check_impl_detail(cpython=True) and ctypes is not None: + del f + + def test_free_different_thread(self): ++ raise unittest.SkipTest("Requires threading") + # Freeing a code object on a different thread then + # where the co_extra was set should be safe. + f = self.get_func() +@@ -438,8 +441,8 @@ def test_main(verbose=None): + from test import test_code + run_doctest(test_code, verbose) + tests = [CodeTest, CodeConstsTest, CodeWeakRefTest] +- if check_impl_detail(cpython=True) and ctypes is not None: +- tests.append(CoExtra) ++ # if check_impl_detail(cpython=True) and ctypes is not None: ++ # tests.append(CoExtra) + run_unittest(*tests) + + if __name__ == "__main__": +diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py +index 23508c5..a618e25 100644 +--- a/Lib/test/test_unicode.py ++++ b/Lib/test/test_unicode.py +@@ -2521,6 +2521,7 @@ class CAPITest(unittest.TestCase): + + # Test PyUnicode_FromFormat() + def test_from_format(self): ++ raise unittest.SkipTest("ctypes don't work with variadic C functions like PyUnicode_FromFormat") + support.import_module('ctypes') + from ctypes import ( + c_char_p, +-- +2.17.1 + diff --git a/cpython/remove_modules.txt b/cpython/remove_modules.txt index 75f9e3cd526..49163a3f1f0 100644 --- a/cpython/remove_modules.txt +++ b/cpython/remove_modules.txt @@ -1,5 +1,4 @@ _osx_support.py -ctypes curses dbm ensurepip diff --git a/docs/project/changelog.md b/docs/project/changelog.md index fee266898da..320d08d96f6 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -56,6 +56,9 @@ substitutions: - The standard library module `audioop` is now included, making the `wave`, `sndhdr`, `aifc`, and `sunau` modules usable. {pr}`1623` +- Added support for `ctypes`. + {pr}`1656` + ### Python / JS type conversions - {{ API }} {any}`pyodide.runPythonAsync` no longer automatically calls diff --git a/emsdk/patches/0001-Throw-away-errors-in-minify_wasm_js.patch b/emsdk/patches/0001-Throw-away-errors-in-minify_wasm_js.patch new file mode 100644 index 00000000000..95f95ca6e9f --- /dev/null +++ b/emsdk/patches/0001-Throw-away-errors-in-minify_wasm_js.patch @@ -0,0 +1,36 @@ +From 310269ed630ead73e89e6bfc15e54e4c90959c95 Mon Sep 17 00:00:00 2001 +From: Hood +Date: Thu, 24 Jun 2021 04:08:02 -0700 +Subject: [PATCH] Throw away errors in minify_wasm_js + +--- + emcc.py | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/emsdk/upstream/emscripten/emcc.py b/emsdk/upstream/emscripten/emcc.py +index 839f791b3..5653470dd 100755 +--- a/emsdk/upstream/emscripten/emcc.py ++++ b/emsdk/upstream/emscripten/emcc.py +@@ -2901,11 +2901,14 @@ def do_binaryen(target, options, wasm_target): + # Closure can print out readable error messages (Closure will then + # minify whitespace afterwards) + save_intermediate_with_wasm('preclean', wasm_target) +- final_js = building.minify_wasm_js(js_file=final_js, +- wasm_file=wasm_target, +- expensive_optimizations=will_metadce(), +- minify_whitespace=minify_whitespace() and not options.use_closure_compiler, +- debug_info=intermediate_debug_info) ++ try: ++ final_js = building.minify_wasm_js(js_file=final_js, ++ wasm_file=wasm_target, ++ expensive_optimizations=will_metadce(), ++ minify_whitespace=minify_whitespace() and not options.use_closure_compiler, ++ debug_info=intermediate_debug_info) ++ except: ++ pass + save_intermediate_with_wasm('postclean', wasm_target) + + if shared.Settings.ASYNCIFY_LAZY_LOAD_CODE: +-- +2.17.1 + diff --git a/packages/imageio/meta.yaml b/packages/imageio/meta.yaml index 1114882fd7f..6eb38282714 100644 --- a/packages/imageio/meta.yaml +++ b/packages/imageio/meta.yaml @@ -4,8 +4,6 @@ package: source: sha256: 52ddbaeca2dccf53ba2d6dec5676ca7bc3b2403ef8b37f7da78b7654bb3e10f0 url: https://files.pythonhosted.org/packages/c3/73/f37f428748c4f10a7991ac5bff00f113a34bcc0d0a78957d6e1cdc29a94e/imageio-2.9.0.tar.gz - patches: - - patches/setitup.patch requirements: run: - numpy diff --git a/packages/imageio/patches/setitup.patch b/packages/imageio/patches/setitup.patch deleted file mode 100644 index a086150da52..00000000000 --- a/packages/imageio/patches/setitup.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/imageio/core/findlib.py b/imageio/core/findlib.py ---- a/imageio/core/findlib.py -+++ b/imageio/core/findlib.py -@@ -7,7 +7,6 @@ - - import os - import sys --import ctypes - - - LOCALDIR = os.path.abspath(os.path.dirname(__file__)) -@@ -95,6 +94,7 @@ def load_lib(exact_lib_names, lib_names, lib_dirs=None): - - Returns ``(ctypes_library, library_path)`` - """ -+ import ctypes - - # Checks - assert isinstance(exact_lib_names, list) - -diff --git a/imageio/plugins/__init__.py b/imageio/plugins/__init__.py -index 7e26683..971f83e 100644 ---- a/imageio/plugins/__init__.py -+++ b/imageio/plugins/__init__.py -@@ -84,8 +84,8 @@ from . import tifffile - from . import pillow - from . import grab - --from . import freeimage --from . import freeimagemulti -+# from . import freeimage -+# from . import freeimagemulti - - from . import ffmpeg - diff --git a/packages/joblib/meta.yaml b/packages/joblib/meta.yaml index 9d1bc1f66a3..e1c45543a77 100644 --- a/packages/joblib/meta.yaml +++ b/packages/joblib/meta.yaml @@ -12,7 +12,6 @@ source: patches: - patches/use-setuptools.patch - - patches/ctypes-import.patch test: imports: diff --git a/packages/joblib/patches/ctypes-import.patch b/packages/joblib/patches/ctypes-import.patch deleted file mode 100644 index 12442d3ce6b..00000000000 --- a/packages/joblib/patches/ctypes-import.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/joblib/backports.py b/joblib/backports.py -index 7dd3df1..a49ef78 100644 ---- a/joblib/backports.py -+++ b/joblib/backports.py -@@ -3,7 +3,6 @@ Backports of fixes for joblib dependencies - """ - import os - import time --import ctypes - import sys - - from distutils.version import LooseVersion -@@ -34,6 +33,8 @@ except ImportError: - - if os.name == 'nt': - error_access_denied = 5 -+ import ctypes -+ - try: - from os import replace - except ImportError: diff --git a/packages/numpy/meta.yaml b/packages/numpy/meta.yaml index d3562c53f54..e9e5912604f 100644 --- a/packages/numpy/meta.yaml +++ b/packages/numpy/meta.yaml @@ -20,7 +20,6 @@ source: - patches/make-int-return-values.patch - patches/fix-ieee754.patch - patches/rm-duplicate-symbols-link.patch - - patches/delay-ctypes-import.patch build: skip_host: False diff --git a/packages/numpy/patches/delay-ctypes-import.patch b/packages/numpy/patches/delay-ctypes-import.patch deleted file mode 100644 index ee994a1c927..00000000000 --- a/packages/numpy/patches/delay-ctypes-import.patch +++ /dev/null @@ -1,86 +0,0 @@ -Delay ctypes imports - -Included in numpy 1.20.0 (https://github.com/numpy/numpy/pull/16387) - -diff --git a/numpy/core/_dtype_ctypes.py b/numpy/core/_dtype_ctypes.py -index 708241289..6d7cbb244 100644 ---- a/numpy/core/_dtype_ctypes.py -+++ b/numpy/core/_dtype_ctypes.py -@@ -22,9 +22,10 @@ Unfortunately, this fails because: - * PEP3118 cannot represent unions, but both numpy and ctypes can - * ctypes cannot handle big-endian structs with PEP3118 (bpo-32780) - """ --import _ctypes --import ctypes - -+# We delay-import ctypes for distributions that do not include it. -+# While this module is not used unless the user passes in ctypes -+# members, it is eagerly imported from numpy/core/__init__.py. - import numpy as np - - -@@ -39,6 +40,7 @@ def _from_ctypes_structure(t): - "ctypes bitfields have no dtype equivalent") - - if hasattr(t, "_pack_"): -+ import ctypes - formats = [] - offsets = [] - names = [] -@@ -79,6 +81,7 @@ def _from_ctypes_scalar(t): - - - def _from_ctypes_union(t): -+ import ctypes - formats = [] - offsets = [] - names = [] -@@ -98,6 +101,7 @@ def dtype_from_ctypes_type(t): - """ - Construct a dtype object from a ctypes type - """ -+ import _ctypes - if issubclass(t, _ctypes.Array): - return _from_ctypes_array(t) - elif issubclass(t, _ctypes._Pointer): -diff --git a/tools/openblas_support.py b/tools/openblas_support.py -index 6b2ad0f8c..cbb6a5e43 100644 ---- a/tools/openblas_support.py -+++ b/tools/openblas_support.py -@@ -207,12 +207,12 @@ def make_init(dirname): - and is created as part of the scripts that build the wheel. - ''' - import os -- from ctypes import WinDLL - import glob - if os.name == 'nt': - # convention for storing / loading the DLL from - # numpy/.libs/, if present - try: -+ from ctypes import WinDLL - basedir = os.path.dirname(__file__) - except: - pass -@@ -221,16 +221,16 @@ def make_init(dirname): - DLL_filenames = [] - if os.path.isdir(libs_dir): - for filename in glob.glob(os.path.join(libs_dir, -- '*openblas*dll')): -+ '*openblas*dll')): - # NOTE: would it change behavior to load ALL - # DLLs at this path vs. the name restriction? - WinDLL(os.path.abspath(filename)) - DLL_filenames.append(filename) -- if len(DLL_filenames) > 1: -- import warnings -- warnings.warn("loaded more than 1 DLL from .libs:\\n%s" % -- "\\n".join(DLL_filenames), -- stacklevel=1) -+ if len(DLL_filenames) > 1: -+ import warnings -+ warnings.warn("loaded more than 1 DLL from .libs:\\n%s" % -+ "\\n".join(DLL_filenames), -+ stacklevel=1) - """)) - - def test_setup(arches): diff --git a/packages/setuptools/meta.yaml b/packages/setuptools/meta.yaml index 3d4e2ca33fd..9490eeea102 100644 --- a/packages/setuptools/meta.yaml +++ b/packages/setuptools/meta.yaml @@ -6,9 +6,6 @@ source: url: https://files.pythonhosted.org/packages/88/fc/d17731c0cc67a5a8e385e4f47c3b0b186720e198b70f076ccb4676804a8f/setuptools-57.0.0.tar.gz sha256: 401cbf33a7bf817d08014d51560fc003b895c4cdc1a5b521ad2969e928a07535 - patches: - - patches/remove-ctypes.patch - requirements: run: - distutils diff --git a/packages/setuptools/patches/remove-ctypes.patch b/packages/setuptools/patches/remove-ctypes.patch deleted file mode 100644 index 5e9f736f7cb..00000000000 --- a/packages/setuptools/patches/remove-ctypes.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 7e50329062af2b51d0e551c6c80fc5b457263639 Mon Sep 17 00:00:00 2001 -From: Hood -Date: Tue, 15 Jun 2021 09:06:01 -0700 -Subject: [PATCH] Remove ctypes import - ---- - setuptools/windows_support.py | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/setuptools/windows_support.py b/setuptools/windows_support.py -index cb977cf..0324739 100644 ---- a/setuptools/windows_support.py -+++ b/setuptools/windows_support.py -@@ -1,5 +1,4 @@ - import platform --import ctypes - - - def windows_only(func): --- -2.17.1 - diff --git a/run_docker b/run_docker index 0cd457ede32..5d16eacf0df 100755 --- a/run_docker +++ b/run_docker @@ -1,7 +1,7 @@ #!/usr/bin/env bash PYODIDE_IMAGE_REPO="pyodide" -PYODIDE_IMAGE_TAG="17" +PYODIDE_IMAGE_TAG="18" PYODIDE_PREBUILT_IMAGE_TAG="0.17.0" DEFAULT_PYODIDE_DOCKER_IMAGE="${PYODIDE_IMAGE_REPO}/pyodide-env:${PYODIDE_IMAGE_TAG}" DEFAULT_PYODIDE_SYSTEM_PORT="8000" diff --git a/src/core/main.c b/src/core/main.c index f39964cf529..2902beef42d 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -132,6 +132,7 @@ main(int argc, char** argv) // For some reason emscripten doesn't make UTF8ToString available on Module // by default... Module.UTF8ToString = UTF8ToString; + Module.wasmTable = wasmTable; }); TRY_INIT_WITH_CORE_MODULE(error_handling);