Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions src/maps
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ def addCLI():
return parser, parser_runtime, parser_remote, parser_pack


def sanity_checks(parsers):
"""Some simple sanity checks, before the program proceeds"""
def sanity_checks(parsers: tuple[argparse.ArgumentParser, argparse.ArgumentParser,
argparse.ArgumentParser, argparse.ArgumentParser]):
"""Some simply sanity checks, before the program proceeds"""
if len(sys.argv) == 1:
parsers[0].print_help()
sys.exit(1)
Expand Down Expand Up @@ -185,7 +186,7 @@ def create_config_file(config_path):
return config


def program_init(repopath):
def program_init(repopath: str):
"""Init function verifies requirements, sets up the repo. Returns the OSTree Repo."""
opt1 = "-q"
opt2 = "1>/dev/null"
Expand Down Expand Up @@ -326,7 +327,7 @@ def program_init(repopath):
return repo


def make_remote_ref_list(repo, remote):
def make_remote_ref_list(repo: OSTree.Repo, remote: str):
"""Given a repo and a remote, return a list of refs in the remote of that repo"""
if remote is None:
return []
Expand All @@ -347,7 +348,7 @@ def make_remote_ref_list(repo, remote):
return remote_refs


def mode_list(repo):
def mode_list(repo: OSTree.Repo):
"""Prints a list of available refs"""
print("Available runtimes are :")
refs = list(repo.list_refs()[1].keys())
Expand All @@ -372,7 +373,7 @@ def list_remotes(repo):
return retval


def mode_remotes(repo, args):
def mode_remotes(repo: OSTree.Repo, args): # todo: type for args?
"""Administrative mode for remotes of the repo"""
if args.LIST is not False:
remotes = list_remotes(repo)
Expand Down Expand Up @@ -581,7 +582,7 @@ def make_bwrap_command(location, command, nogui, gui):
return bwrapstring, senv


def mode_run(repo, args):
def mode_run(repo, args): # TODO
"""Function to execute a deployed environment"""

remote, runtime = disambiguate_runtime(repo, args.RUN, installed=True)
Expand Down Expand Up @@ -661,7 +662,7 @@ def download(repo, repopath, remote, target):


# Uninstall
def uninstall_runtime(repo, args):
def uninstall_runtime(repo: OSTree.repo, args): # todo: type for args?
"""Function to remove a runtime from both the local disk checkout, and the local repo"""
# Check if runtime is checked out
FLAG_DIREXISTS = False
Expand Down Expand Up @@ -723,7 +724,7 @@ def validate_runtime_name(runtime_id: str):


# Update
def mode_update(repo, repopath, args, remote=""):
def mode_update(repo, repopath, args, remote=""): # TODO
"""Function to update a runtime identifier to its recent version (if any)"""
if not args.UPDATE:
args.UPDATE = args.DEPLOY
Expand Down Expand Up @@ -808,7 +809,7 @@ def checkout(repo, remote, runtime):


# Deploy Mode
def mode_deploy(repo, repopath, args):
def mode_deploy(repo: OSTree.Repo, repopath: str, args): # todo: type for args?
"""Function to deploy from repo to local disk"""

remote, runtime = disambiguate_runtime(repo, args.DEPLOY, installed=False)
Expand Down Expand Up @@ -872,7 +873,7 @@ def blank_options():


# Package Mode
def mode_package(repo, repopath, args):
def mode_package(repo, repopath, args): #TODO
"""Function for package mode. Not intended to be used by "end users" """
if args.DIR is not None:
refhash = ''
Expand Down Expand Up @@ -936,7 +937,7 @@ def mode_package(repo, repopath, args):
upload(repo, args.UPLOAD)


def commit(zarglist):
def commit(zarglist: list):
"""
Function commits a tree to a repo in branch asynchronously,
so spinner can be animated in the main thread to show activity.
Expand Down Expand Up @@ -965,7 +966,7 @@ def commit(zarglist):
repo.commit_transaction(None)


def reset(repo, runtime):
def reset(repo, runtime): #TODO
"""
Function resets a runtime, simply by deleting the contents of the "rwfs" dir.
"""
Expand Down Expand Up @@ -1090,7 +1091,7 @@ def mode_url(repo, repopath, args):


# runtime mode: the default path for execution
def mode_runtime(repo, repopath, args):
def mode_runtime(repo: OSTree.Repo, repopath: str, args):
"""
Runtime mode, the default path for execution, and the "end user" mode.
"""
Expand Down
Loading