This adds libheif and Python packages that use libheif to support HEIC image format.
Note that this is "decoder" only. libheif use libde265 for decoder and libx265 for encoder, and I only added libde265 in this PR. I think decoding is more important in our use case, hence this PR.
This fixes the behavior of searching meta.yaml recursively inside the extracted package source directory.
It sometimes cause error on packages that contain local meta.yaml file due to conda support.
This PR adds an API pyodide.mountNativeFS which mounts FileSystemDirectoryHandle into a Pyodide Python file system.
Note that there are some limitations such as:
- File System Access API is only supported by Chromium-based browsers (Safari also implements a portion of it but they only support Origin Private File system so it is not very useful for common users).
- The file system is asynchronous, so one needs to call syncfs to persist changes.
Since it is asynchronous, it does not require any WebWorker, SharedArrayBuffer, or Atomics. But I think we can extend this to a synchronous version using those features
This PR makes building CMake based packages easier.
- Introduce a custom toolchain file for Pyodide. It inherits most of settings from the original Emscripten toolchain file with some modifications. Packages built by pyodide-build will automatically use that toolchain file.
- Proxy cmake in pywasmcross.py, in order to proxy other compiler toolchains.
Some people have expressed the difficulty that certain JavaScript frameworks
use `this` in critical ways and so a `PyProxy` callback cannot be handed to them
because there is no way for the `PyProxy` to get access to the `this` argument.
See #2901 for example. The goal of this PR is to address this. We cannot always
pass `this` through because usually it isn't useful. So the idea is to add an internal
setting on the `PyProxy` indicating whether it should be passed and some way to
set this setting. Currently I've added a method called `captureThis` which indicates
that `this` should be passed as an argument to Python.
Currently `pip` can't invoke the Pyodide build backend, but it should still be
able to build pure Python packages from source. To allow this, we need to
restore `_PYTHON_SYSCONFIGDATA_NAME` so that it isn't inherited by
subprocesses. Otherwise, they will fail to import `sysconfig` because the
subprocess doesn't have our altered `sys.path`. Annoyingly, when pip invokes
the subprocess it seems to pass `_PYTHON_SYSCONFIGDATA_NAME` down
but not `PYTHONPATH` so just setting the `PYTHONPATH` isn't good enough.
Instead of calling `loadWebAssemblyModule` and saving it to
`preloadedWasm`, directly call `loadDynamicLibrary` with proper
`fs` args to locate other shared libs that are dependent.
This uses sed to insert /* webpackIgnore: true */ comments into pyodide.js.
This resolves#3087. I also enabled a check that a simple webpack config
builds without warnings. In the future it would be good to add a test that it
also runs without error.