Unverified Commit c09ae7d0 authored by Oskar Roesler's avatar Oskar Roesler Committed by GitHub
Browse files

Merge pull request #9 from ros-arch/multiple_packages

Allow handling of multiple packages
parents 179c6a92 5389f215
......@@ -25,7 +25,8 @@ def main(argv):
parser.add_argument('command', choices=[
'clone', 'pull', 'build', 'deploy', 'update'])
parser.add_argument('package', type=str)
parser.add_argument('packages', type=str, nargs='+',
help="One or multiple packages that should be handled")
exclu_group.add_argument(
'-v', '--verbose', help='Increase verbosity', action="store_true")
exclu_group.add_argument(
......@@ -33,28 +34,29 @@ def main(argv):
args = parser.parse_args(argv)
def retry_with_rosdistro_name(check_path=False):
def retry_with_rosdistro_name(package, check_path=False):
routines = Routines()
name = "ros-{0}-{1}".format(routines.get_ros_distro(), args.package)
name = "ros-{0}-{1}".format(routines.get_ros_distro(), package)
if not check_path or os.path.exists(os.path.join(routines.cache_path, 'packages', name)):
try:
commands(args.command, name, args.verbose, args.quiet)
except KeyError:
print(f"Error: {args.package} could not be found in ROS Metainfo dict while running {args.command}",
print(f"Error: {package} could not be found in ROS Metainfo dict while running {args.command}",
file=sys.stderr)
except FileNotFoundError:
print(
f"Error: {args.package} folder could not be found while running {args.command}", file=sys.stderr)
f"Error: {name} folder could not be found while running {args.command}", file=sys.stderr)
else:
print(
f"Error: {args.package} is not on disk. Try to clone it.", file=sys.stderr)
try:
commands(args.command, args.package, args.verbose, args.quiet)
except KeyError:
retry_with_rosdistro_name()
except FileNotFoundError:
retry_with_rosdistro_name(check_path=True)
f"Error: {package} is not on disk. Try to clone it.", file=sys.stderr)
for package in args.packages:
try:
commands(args.command, package, args.verbose, args.quiet)
except KeyError:
retry_with_rosdistro_name(package)
except FileNotFoundError:
retry_with_rosdistro_name(package, check_path=True)
if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment