install multiple packages at once with the install command
This commit is contained in:
@@ -12,19 +12,7 @@ from util import check_ground_libs_path, check_sudo
|
|||||||
console = Console()
|
console = Console()
|
||||||
|
|
||||||
|
|
||||||
def install(args):
|
def install_package(package_name, version, args):
|
||||||
|
|
||||||
check_sudo()
|
|
||||||
check_ground_libs_path()
|
|
||||||
|
|
||||||
# figure out which version to install
|
|
||||||
package_name = args.name
|
|
||||||
version = "latest"
|
|
||||||
if "@" in args.name:
|
|
||||||
split = package_name.split("@")
|
|
||||||
package_name = split[0]
|
|
||||||
version = split[1]
|
|
||||||
|
|
||||||
retries_left = args.max_retries
|
retries_left = args.max_retries
|
||||||
|
|
||||||
with console.status("Downloading tarball...", spinner="bouncingBall", spinner_style="blue") as status:
|
with console.status("Downloading tarball...", spinner="bouncingBall", spinner_style="blue") as status:
|
||||||
@@ -83,3 +71,19 @@ def install(args):
|
|||||||
os.symlink(os.path.join(extract_dir, package_name, "main.so"), symlink_path)
|
os.symlink(os.path.join(extract_dir, package_name, "main.so"), symlink_path)
|
||||||
|
|
||||||
console.print("[:white_check_mark:] Done!")
|
console.print("[:white_check_mark:] Done!")
|
||||||
|
|
||||||
|
def install(args):
|
||||||
|
|
||||||
|
check_sudo()
|
||||||
|
check_ground_libs_path()
|
||||||
|
|
||||||
|
for package in args.names:
|
||||||
|
# figure out which version to install
|
||||||
|
package_name = package
|
||||||
|
version = "latest"
|
||||||
|
if "@" in package:
|
||||||
|
split = package.split("@")
|
||||||
|
package_name = split[0]
|
||||||
|
version = split[1]
|
||||||
|
|
||||||
|
install_package(package_name, version, args)
|
||||||
@@ -15,7 +15,7 @@ def parse_arguments():
|
|||||||
|
|
||||||
# install command
|
# install command
|
||||||
install_command = sub_parsers.add_parser(name="install", description="install a mineral")
|
install_command = sub_parsers.add_parser(name="install", description="install a mineral")
|
||||||
install_command.add_argument("name", help="name of the mineral to install")
|
install_command.add_argument("names", help="name of the minerals to install", nargs="+")
|
||||||
install_command.add_argument("--max-retries", help="max number of download retries before giving up", default=3, type=int)
|
install_command.add_argument("--max-retries", help="max number of download retries before giving up", default=3, type=int)
|
||||||
|
|
||||||
# uninstall command
|
# uninstall command
|
||||||
|
|||||||
Reference in New Issue
Block a user