2023-01-04 15:07:07 +00:00
|
|
|
import sys
|
|
|
|
from pathlib import Path
|
|
|
|
|
2023-01-14 13:59:42 +00:00
|
|
|
import typer
|
2023-01-04 15:07:07 +00:00
|
|
|
|
|
|
|
from pyodide_build._py_compile import _py_compile_wheel
|
|
|
|
|
|
|
|
|
|
|
|
def main(
|
|
|
|
wheel_path: Path = typer.Argument(..., help="Path to the input wheel"),
|
2023-03-21 08:11:47 +00:00
|
|
|
compression_level: int = typer.Option(
|
|
|
|
6, help="Compression level to use for the created zip file"
|
|
|
|
),
|
2023-01-04 15:07:07 +00:00
|
|
|
) -> None:
|
|
|
|
"""Compile .py files to .pyc in a wheel"""
|
|
|
|
if wheel_path.suffix != ".whl":
|
|
|
|
typer.echo(f"Error: only .whl files are supported, got {wheel_path.name}")
|
|
|
|
sys.exit(1)
|
2023-03-21 08:11:47 +00:00
|
|
|
_py_compile_wheel(wheel_path, verbose=False, compression_level=compression_level)
|