diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100755 index 000000000..43a2b6622 --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." +./scripts/init_workspace + +# if there's an appctl directory behind us, link it in +[ -e ../appctl/appctl ] && ./scripts/init_workspace -x ${PWD}/../appctl/appctl diff --git a/scripts/console b/scripts/console new file mode 100755 index 000000000..40795e1e3 --- /dev/null +++ b/scripts/console @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +cd "$(dirname "$0")/.." + +./scripts/bootstrap + +[[ "$(docker images | grep -c lg_ros_nodes.*latest)" == 0 ]] && ./scripts/update + +MOUNTS="" + +for rosnode in $(ls catkin/src/* -d | grep -v CMake); do + # $rosnode is catkin/src/package_name + MOUNTS="${MOUNTS} -v $(readlink ${rosnode}):/src/lg_ros_nodes/${rosnode}" +done + +echo ${MOUNTS} + +docker run ${MOUNTS} -it lg_ros_nodes:latest /bin/bash -c " + cd /src/lg_ros_nodes/catkin + source devel/setup.bash + source ../scripts/docker_xvfb_add.sh + echo 'run catkin_make before anything' + /bin/bash +" diff --git a/scripts/init_workspace b/scripts/init_workspace index eb7c25738..159e74d5c 100755 --- a/scripts/init_workspace +++ b/scripts/init_workspace @@ -1,9 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import argparse from subprocess import Popen -from ConfigParser import RawConfigParser, NoSectionError, NoOptionError +from configparser import RawConfigParser, NoSectionError, NoOptionError # make sure to set the root directory ROOT_DIR = os.path.realpath(os.curdir) @@ -37,7 +37,7 @@ def parse_config(): """ config_file = 'scripts/init.cfg' if not os.path.exists(config_file): - print 'WARNING, no %s found, using possibly outdated configuration' % config_file + print(f"WARNING, no {config_file} found, using possibly outdated configuration") return # rely on hard coded values... maybe an exception would work # setting these globals global IGNORE_DIRS @@ -186,9 +186,9 @@ def check_validity(): for needed in NEEDED_DIRS: if needed not in links: passed = False - print "############## WARNING catkin/src SHOULD HAVE %s LINK ##############" % needed + print(f"############## WARNING catkin/src SHOULD HAVE {needed} LINK ##############") if passed: - print "Successfully completed workspace initialization" + print("Successfully completed workspace initialization") def main(): diff --git a/scripts/update b/scripts/update new file mode 100755 index 000000000..3b0946684 --- /dev/null +++ b/scripts/update @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -e + +cd "$(dirname "$0")/.." +docker build . -t lg_ros_nodes