-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92e9511
commit d825167
Showing
8 changed files
with
677 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
from .spec import PackageSpec, PyodideLockSpec | ||
from .spec import InfoSpec, PackageSpec, PyodideLockSpec | ||
from .utils import parse_top_level_import_name | ||
|
||
__all__ = [ | ||
"PyodideLockSpec", | ||
"PackageSpec", | ||
"InfoSpec", | ||
"parse_top_level_import_name", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from pathlib import Path | ||
|
||
import typer | ||
|
||
from .spec import PyodideLockSpec | ||
from .utils import add_wheels_to_spec | ||
|
||
main = typer.Typer(help="manipulate pyodide-lock.json lockfiles.") | ||
|
||
|
||
@main.command() | ||
def add_wheels( | ||
wheels: list[Path], | ||
ignore_missing_dependencies: bool = typer.Option( | ||
help="If this is true, dependencies " | ||
"which are not in the original lockfile or " | ||
"the added wheels will be added to the lockfile. " | ||
"Warning: This will allow a broken lockfile to " | ||
"be created.", | ||
default=False, | ||
), | ||
input: Path = typer.Option( | ||
help="Source lockfile", default=Path("pyodide-lock.json") | ||
), | ||
output: Path = typer.Option( | ||
help="Updated lockfile", default=Path("pyodide-lock-new.json") | ||
), | ||
base_path: Path = typer.Option( | ||
help="Base path for wheels - wheel file " | ||
"names will be created relative to this path.", | ||
default=None, | ||
), | ||
wheel_url: str = typer.Option( | ||
help="Base url which will be appended to the wheel location." | ||
"Use this if you are hosting these wheels on a different " | ||
"server to core pyodide packages", | ||
default="", | ||
), | ||
): | ||
"""Add a set of package wheels to an existing pyodide-lock.json and | ||
write it out to pyodide-lock-new.json | ||
Each package in the wheel will be added to the output lockfile, | ||
including resolution of dependencies in the lock file. By default | ||
this will fail if a dependency isn't available in either the | ||
existing lock file, or in the set of new wheels. | ||
""" | ||
sp = PyodideLockSpec.from_json(input) | ||
add_wheels_to_spec( | ||
sp, | ||
wheels, | ||
base_path=base_path, | ||
base_url=wheel_url, | ||
ignore_missing_dependencies=ignore_missing_dependencies, | ||
) | ||
sp.to_json(output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.