Skip to content

Commit

Permalink
check targets
Browse files Browse the repository at this point in the history
  • Loading branch information
caila-marashaj committed May 13, 2024
1 parent 26fab8e commit 030a2cb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions push
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ _DEFAULT_EXTRAS = {'stdout': sys.stdout, 'stderr': sys.stderr}
_SSH_EXTRA_OPTS = ['-o', 'StrictHostKeyChecking=no',
'-o', 'UserKnownHostsFile=/dev/null']
_ROBOT_MANIFEST_FILE_PATH = "/usr/lib/firmware/opentrons-firmware.json"
TARGETS = [
"pipettes",
"pipettes-rev1",
"pipettes-single",
"pipettes-multi",
"pipettes-96",
"gripper",
"hepa-uv",
"gantry",
"gantry-x",
"gantry-y",
"head",
"rear-panel",
"bootloader",
]

class CantFindUtilityException(RuntimeError):
def __init__(self, which_util):
Expand Down Expand Up @@ -145,12 +160,21 @@ def _find_utils():
raise CantFindUtilityException('cmake')
return ssh, scp, cmake

def _check_targets(targets):
for t in targets:
if t not in TARGETS:
print(f"preset {t} is not in target options, ignoring")
targets.remove(t)
return targets

def _restart_robot(host, ssh):
_ssh(ssh, host, 'nohup systemctl restart opentrons-robot-server &')

def _do_push(host, repo_path, build, restart, sensors, targets):

ssh, scp, cmake = _find_utils()
if targets:
targets = _check_targets(targets)
if build:
_prep_firmware(repo_path, cmake, sensors, targets)
with _prep_robot(host, ssh):
Expand Down

0 comments on commit 030a2cb

Please sign in to comment.