-
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
462ecb2
commit ba8ac4c
Showing
5 changed files
with
138 additions
and
97 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,61 +1,57 @@ | ||
from pathlib import Path | ||
|
||
try: | ||
import typer | ||
import typer | ||
|
||
from .spec import PyodideLockSpec | ||
from .utils import add_wheels_to_spec | ||
from .spec import PyodideLockSpec | ||
from .utils import add_wheels_to_spec | ||
|
||
main = typer.Typer() | ||
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, | ||
), | ||
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. | ||
@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 | ||
""" | ||
sp = PyodideLockSpec.from_json(in_lockfile) | ||
add_wheels_to_spec( | ||
sp, | ||
wheels, | ||
base_path=base_path, | ||
base_url=wheel_url, | ||
ignore_missing_dependencies=ignore_missing_dependencies, | ||
) | ||
sp.to_json(out_lockfile) | ||
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. | ||
except ImportError: | ||
pass | ||
# no typer = no cli | ||
""" | ||
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
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
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
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