# Path: ros2_batch_job/util.py
# def info(*args, **kwargs):
#     log("@!II>@| ", *args, **kwargs)


import glob
import os
import platform
import shutil
import sys
import tarfile
import zipfile
from .util import info
                '--base-paths', '"%s"' % args.sourcespace,
                '--build-base', '"%s"' % args.buildspace,
                '--install-base', '"%s"' % args.installspace,
                '--cmake-args', '-DBUILD_TESTING=ON', '--no-warn-unused-cli',
                '--event-handlers', 'console_direct+',
            ] + ['--packages-select'] + args.mixed_ros_overlay_pkgs +
                (['--merge-install'] if not args.isolated else []) +
                (
                    ['--cmake-args', '-DCMAKE_BUILD_TYPE=' +
                        args.cmake_build_type]
                    if args.cmake_build_type else []
            ), env=env)
            print('# END SUBSECTION')

            print('# BEGIN SUBSECTION: install Python packages for ros1_bridge test')
            job.run(['"%s"' % job.python, '-m', 'pip', 'install', '-U', 'catkin_pkg', 'rospkg'], shell=True)
            print('# END SUBSECTION')

            print('# BEGIN SUBSECTION: test overlay packages')
            ret_test = job.run([
                args.colcon_script, 'test',
                '--base-paths', '"%s"' % args.sourcespace,
                '--build-base', '"%s"' % args.buildspace,
                '--install-base', '"%s"' % args.installspace,
            ] + ['--packages-select'] + args.mixed_ros_overlay_pkgs +
                # Ignore return codes that indicate test failures;
                # they'll be picked up later in test reporting.
                # '--ignore-return-codes',
                (['--merge-install'] if not args.isolated else []) +
                args.test_args, exit_on_error=False, shell=True)

# Path: ros2_batch_job/util.py
# def info(*args, **kwargs):
#     log("@!II>@| ", *args, **kwargs)


# Path: ros2_batch_job/packaging.py
import glob
import os
import platform
import shutil
import sys
import tarfile
import zipfile
from .util import info

                '--base-paths', '"%s"' % args.sourcespace,
                '--build-base', '"%s"' % args.buildspace,
                '--install-base', '"%s"' % args.installspace,
                '--cmake-args', '-DBUILD_TESTING=ON', '--no-warn-unused-cli',
                '--event-handlers', 'console_direct+',
            ] + ['--packages-select'] + args.mixed_ros_overlay_pkgs +
                (['--merge-install'] if not args.isolated else []) +
                (
                    ['--cmake-args', '-DCMAKE_BUILD_TYPE=' +
                        args.cmake_build_type]
                    if args.cmake_build_type else []
            ), env=env)
            print('# END SUBSECTION')

            print('# BEGIN SUBSECTION: install Python packages for ros1_bridge test')
            job.run(['"%s"' % job.python, '-m', 'pip', 'install', '-U', 'catkin_pkg', 'rospkg'], shell=True)
            print('# END SUBSECTION')

            print('# BEGIN SUBSECTION: test overlay packages')
            ret_test = job.run([
                args.colcon_script, 'test',
                '--base-paths', '"%s"' % args.sourcespace,
                '--build-base', '"%s"' % args.buildspace,
                '--install-base', '"%s"' % args.installspace,
            ] + ['--packages-select'] + args.mixed_ros_overlay_pkgs +
                # Ignore return codes that indicate test failures;
                # they'll be picked up later in test reporting.
                # '--ignore-return-codes',
                (['--merge-install'] if not args.isolated else []) +
                args.test_args, exit_on_error=False, shell=True)

            info("test returned: '{0}'".format(ret_test))