2023-02-22 02:56:35 +00:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
import typer
|
|
|
|
|
2023-04-07 11:54:11 +00:00
|
|
|
from ..create_xbuildenv import create
|
2023-02-22 02:56:35 +00:00
|
|
|
from ..install_xbuildenv import install
|
2023-04-07 11:54:11 +00:00
|
|
|
from ..logger import logger
|
2023-02-22 02:56:35 +00:00
|
|
|
|
2023-04-07 11:54:11 +00:00
|
|
|
app = typer.Typer(hidden=True, no_args_is_help=True)
|
2023-02-22 02:56:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
@app.callback()
|
|
|
|
def callback():
|
|
|
|
"""
|
|
|
|
Create or install cross build environment
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2023-06-06 21:21:03 +00:00
|
|
|
@app.command("install")
|
2023-02-22 02:56:35 +00:00
|
|
|
def _install(
|
|
|
|
path: Path = typer.Option(".pyodide-xbuildenv", help="path to xbuildenv directory"),
|
|
|
|
download: bool = typer.Option(False, help="download xbuildenv before installing"),
|
|
|
|
url: str = typer.Option(None, help="URL to download xbuildenv from"),
|
|
|
|
) -> None:
|
|
|
|
"""
|
|
|
|
Install xbuildenv.
|
|
|
|
|
2023-03-13 21:45:06 +00:00
|
|
|
The installed environment is the same as the one that would result from
|
2023-02-22 02:56:35 +00:00
|
|
|
`PYODIDE_PACKAGES='scipy' make` except that it is much faster.
|
|
|
|
The goal is to enable out-of-tree builds for binary packages that depend
|
|
|
|
on numpy or scipy.
|
|
|
|
Note: this is a private endpoint that should not be used outside of the Pyodide Makefile.
|
|
|
|
"""
|
|
|
|
install(path, download=download, url=url)
|
2023-04-07 11:54:11 +00:00
|
|
|
logger.info(f"xbuildenv installed at {path.resolve()}")
|
|
|
|
|
|
|
|
|
2023-06-06 21:21:03 +00:00
|
|
|
@app.command("create")
|
2023-04-07 11:54:11 +00:00
|
|
|
def _create(
|
|
|
|
path: Path = typer.Argument(
|
|
|
|
".pyodide-xbuildenv", help="path to xbuildenv directory"
|
|
|
|
),
|
|
|
|
root: Path = typer.Option(
|
|
|
|
None, help="path to pyodide root directory, if not given, will be inferred"
|
|
|
|
),
|
|
|
|
skip_missing_files: bool = typer.Option(
|
|
|
|
False,
|
|
|
|
help="skip if cross build files are missing instead of raising an error. This is useful for testing.",
|
|
|
|
),
|
|
|
|
) -> None:
|
|
|
|
"""
|
|
|
|
Create xbuildenv.
|
|
|
|
|
|
|
|
The create environment is then used to cross-compile packages out-of-tree.
|
|
|
|
Note: this is a private endpoint that should not be used outside of the Pyodide Makefile.
|
|
|
|
"""
|
|
|
|
|
|
|
|
create(path, pyodide_root=root, skip_missing_files=skip_missing_files)
|
|
|
|
logger.info(f"xbuildenv created at {path.resolve()}")
|