diff --git a/VERSION b/VERSION index b620a1e1..adb9d57d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -47.0.1 +48.0.0 diff --git a/ci/download-wasmtime.py b/ci/download-wasmtime.py index cd5ac8fa..0bb4ce62 100644 --- a/ci/download-wasmtime.py +++ b/ci/download-wasmtime.py @@ -12,7 +12,7 @@ # set to "dev" to download the latest or pick a tag from # https://github.com/bytecodealliance/wasmtime/tags -WASMTIME_VERSION = "v47.0.0" +WASMTIME_VERSION = "v48.0.0" def main(platform, arch): diff --git a/tests/component/test_linker.py b/tests/component/test_linker.py index a424bc18..8dace947 100644 --- a/tests/component/test_linker.py +++ b/tests/component/test_linker.py @@ -34,10 +34,10 @@ def test_add_instance(self): pass with root.add_instance('y'): pass - with self.assertRaises(WasmtimeError): - root.add_instance('x') - with self.assertRaises(WasmtimeError): - root.add_instance('y') + with root.add_instance('x'): + pass + with root.add_instance('y'): + pass with root.add_instance('z'): pass diff --git a/tests/test_wasi.py b/tests/test_wasi.py index ac256c07..8ac87ec6 100644 --- a/tests/test_wasi.py +++ b/tests/test_wasi.py @@ -30,7 +30,7 @@ def test_config(self): config.stdout_file = 'some-directory/without-a-rainbow' with self.assertRaises(WasmtimeError): config.stderr_file = 'some-directory/without-a-rainbow' - config.preopen_dir('wasmtime', 'other', DirPerms.READ_WRITE, FilePerms.READ_WRITE) + config.preopen_dir('wasmtime', 'other', True) config.preopen_dir('wasmtime', 'other2') def test_preview1(self): @@ -51,7 +51,7 @@ def test_preview1(self): def preopen_nonexistent(self): config = WasiConfig() with self.assertRaises(WasmtimeError): - config.preopen_dir('/path/to/nowhere', '/', DirPerms.READ_ONLY, FilePerms.READ_ONLY) + config.preopen_dir('/path/to/nowhere', '/', False) def test_custom_print(self): linker = Linker(Engine()) diff --git a/wasmtime/__init__.py b/wasmtime/__init__.py index d568631a..9317144b 100644 --- a/wasmtime/__init__.py +++ b/wasmtime/__init__.py @@ -29,7 +29,7 @@ from ._table import Table from ._memory import Memory from ._instance import Instance -from ._wasi import WasiConfig, FilePerms, DirPerms +from ._wasi import WasiConfig from ._linker import Linker from ._tag import Tag from ._instance_pre import InstancePre @@ -62,8 +62,6 @@ 'Module', 'Instance', 'WasiConfig', - 'FilePerms', - 'DirPerms', 'Linker', 'WasmtimeError', 'StoreContext', diff --git a/wasmtime/_bindings.py b/wasmtime/_bindings.py index 82e6ae2d..390f3f82 100644 --- a/wasmtime/_bindings.py +++ b/wasmtime/_bindings.py @@ -2055,23 +2055,13 @@ def wasi_config_inherit_stderr(config: Any) -> None: def wasi_config_set_stderr_custom(config: Any, callback: Any, data: Any, finalizer: Any) -> None: return _wasi_config_set_stderr_custom(config, callback, data, finalizer) # type: ignore -class wasi_dir_perms_flags(Enum): - WASMTIME_WASI_DIR_PERMS_READ = 1 - WASMTIME_WASI_DIR_PERMS_WRITE = 2 - -wasi_dir_perms = ctypes.c_size_t - -class wasi_file_perms_flags(Enum): - WASMTIME_WASI_FILE_PERMS_READ = 1 - WASMTIME_WASI_FILE_PERMS_WRITE = 2 - wasi_file_perms = ctypes.c_size_t _wasi_config_preopen_dir = dll.wasi_config_preopen_dir _wasi_config_preopen_dir.restype = ctypes.c_bool -_wasi_config_preopen_dir.argtypes = [ctypes.POINTER(wasi_config_t), ctypes.POINTER(ctypes.c_char), ctypes.POINTER(ctypes.c_char), wasi_dir_perms, wasi_file_perms] -def wasi_config_preopen_dir(config: Any, host_path: Any, guest_path: Any, dir_perms: Any, file_perms: Any) -> bool: - return _wasi_config_preopen_dir(config, host_path, guest_path, dir_perms, file_perms) # type: ignore +_wasi_config_preopen_dir.argtypes = [ctypes.POINTER(wasi_config_t), ctypes.POINTER(ctypes.c_char), ctypes.POINTER(ctypes.c_char), ctypes.c_bool] +def wasi_config_preopen_dir(config: Any, host_path: Any, guest_path: Any, fs_mutable: Any) -> bool: + return _wasi_config_preopen_dir(config, host_path, guest_path, fs_mutable) # type: ignore wasmtime_storage_type_kind_t = ctypes.c_uint8 diff --git a/wasmtime/_wasi.py b/wasmtime/_wasi.py index 824780d8..c85c14c7 100644 --- a/wasmtime/_wasi.py +++ b/wasmtime/_wasi.py @@ -21,16 +21,6 @@ def _encode_path(path: Union[str, bytes, PathLike]) -> bytes: return path2 return path2.encode('utf8') -class DirPerms(Enum): - READ_ONLY = ffi.wasi_dir_perms_flags.WASMTIME_WASI_DIR_PERMS_READ.value - WRITE_ONLY = ffi.wasi_dir_perms_flags.WASMTIME_WASI_DIR_PERMS_WRITE.value - READ_WRITE = ffi.wasi_dir_perms_flags.WASMTIME_WASI_DIR_PERMS_READ.value | ffi.wasi_dir_perms_flags.WASMTIME_WASI_DIR_PERMS_WRITE.value - -class FilePerms(Enum): - READ_ONLY = ffi.wasi_file_perms_flags.WASMTIME_WASI_FILE_PERMS_READ.value - WRITE_ONLY = ffi.wasi_file_perms_flags.WASMTIME_WASI_FILE_PERMS_WRITE.value - READ_WRITE = ffi.wasi_file_perms_flags.WASMTIME_WASI_FILE_PERMS_READ.value | ffi.wasi_file_perms_flags.WASMTIME_WASI_FILE_PERMS_WRITE.value - CustomOutput = Callable[[bytes], Union[int, None]] CUSTOM_OUTPUTS: Slab[CustomOutput] = Slab() @@ -179,7 +169,7 @@ def inherit_stderr(self) -> None: """ ffi.wasi_config_inherit_stderr(self.ptr()) - def preopen_dir(self, path: str, guest_path: str, dir_perms: DirPerms = DirPerms.READ_WRITE, file_perms: FilePerms = FilePerms.READ_WRITE) -> None: + def preopen_dir(self, path: str, guest_path: str, fs_mutable: bool = True) -> None: """ Allows the WASI program to access the directory at `path` using the path `guest_path` within the WASI program. @@ -193,7 +183,7 @@ def preopen_dir(self, path: str, guest_path: str, dir_perms: DirPerms = DirPerms """ path_ptr = c_char_p(path.encode('utf-8')) guest_path_ptr = c_char_p(guest_path.encode('utf-8')) - if not ffi.wasi_config_preopen_dir(self.ptr(), path_ptr, guest_path_ptr, dir_perms.value, file_perms.value): + if not ffi.wasi_config_preopen_dir(self.ptr(), path_ptr, guest_path_ptr, fs_mutable): raise WasmtimeError('failed to add preopen dir')