-
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
1bc04ee
commit 44a80bb
Showing
2 changed files
with
55 additions
and
47 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,55 +1,59 @@ | ||
from pathlib import Path | ||
|
||
import typer | ||
try: | ||
import typer | ||
|
||
from ..spec import PyodideLockSpec | ||
from ..spec import PyodideLockSpec | ||
|
||
main = typer.Typer() | ||
main = typer.Typer() | ||
|
||
@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, | ||
), | ||
in_lockfile: Path = typer.Option( | ||
help="Source lockfile (input)", default=Path("pyodide-lock.json") | ||
), | ||
out_lockfile: Path = typer.Option( | ||
help="Updated lockfile (output)", 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 | ||
@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, | ||
), | ||
in_lockfile: Path = typer.Option( | ||
help="Source lockfile (input)", default=Path("pyodide-lock.json") | ||
), | ||
out_lockfile: Path = typer.Option( | ||
help="Updated lockfile (output)", 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. | ||
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(in_lockfile) | ||
sp.add_wheels( | ||
wheels, | ||
base_path=base_path, | ||
base_url=wheel_url, | ||
ignore_missing_dependencies=ignore_missing_dependencies, | ||
) | ||
sp.to_json(out_lockfile) | ||
|
||
""" | ||
sp = PyodideLockSpec.from_json(in_lockfile) | ||
sp.add_wheels( | ||
wheels, | ||
base_path=base_path, | ||
base_url=wheel_url, | ||
ignore_missing_dependencies=ignore_missing_dependencies, | ||
) | ||
sp.to_json(out_lockfile) | ||
except ImportError: | ||
pass | ||
# no typer = no cli |
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