Exemple #1
0
def deploy_prefix_level_setup_files(context):
    # deploy prefix-level setup files
    for name in get_prefix_level_template_names():
        if name.endswith('.in'):
            deploy_file(context, context.build_space, name[:-3])
        else:
            template_path = get_prefix_level_template_path(name)
            deploy_file(
                context, os.path.dirname(template_path), os.path.basename(template_path))
Exemple #2
0
def deploy_prefix_level_setup_files(context):
    # deploy prefix-level setup files
    for name in get_prefix_level_template_names():
        if name.endswith('.in'):
            deploy_file(context, context.build_space, name[:-3])
        else:
            template_path = get_prefix_level_template_path(name)
            deploy_file(context, os.path.dirname(template_path),
                        os.path.basename(template_path))
Exemple #3
0
    def on_install(self, context):
        # deploy package manifest
        deploy_file(context,
                    context.source_space,
                    'package.xml',
                    dst_subfolder=os.path.join('share',
                                               context.package_manifest.name))

        # create marker file
        marker_file = os.path.join(context.install_space, 'share',
                                   'ament_index', 'resource_index', 'packages',
                                   context.package_manifest.name)
        if not os.path.exists(marker_file):
            marker_dir = os.path.dirname(marker_file)
            if not os.path.exists(marker_dir):
                os.makedirs(marker_dir)
            with open(marker_file, 'w'):  # "touching" the file
                pass

        ext = '.sh' if not IS_WINDOWS else '.bat'
        # deploy AMENT_PREFIX_PATH environment hook
        app_template_path = get_environment_hook_template_path(
            'ament_prefix_path' + ext)
        deploy_file(context,
                    os.path.dirname(app_template_path),
                    os.path.basename(app_template_path),
                    dst_subfolder=os.path.join('share',
                                               context.package_manifest.name,
                                               'environment'))

        # deploy PATH environment hook
        path_template_path = get_environment_hook_template_path('path' + ext)
        deploy_file(context,
                    os.path.dirname(path_template_path),
                    os.path.basename(path_template_path),
                    dst_subfolder=os.path.join('share',
                                               context.package_manifest.name,
                                               'environment'))

        # deploy CLASSPATH environment hook
        destination_file = 'classpath' + ('.sh' if not IS_WINDOWS else '.bat')
        deploy_file(
            context, context.build_space,
            os.path.join('share', context.package_manifest.name, 'environment',
                         destination_file))

        # deploy package-level setup files
        for name in get_package_level_template_names():
            assert name.endswith('.in')
            deploy_file(
                context, context.build_space,
                os.path.join('share', context.package_manifest.name,
                             name[:-3]))

        yield BuildAction(self._prepare_cmd(context, gradle_task='assemble'),
                          cwd=context.build_space)
Exemple #4
0
    def deploy_files(self, context, filesDir):
        dir = os.path.join(context.build_space, filesDir)

        if os.path.exists(dir):
            for filename in os.listdir(dir):
                if not os.path.isdir(
                        os.path.join(dir, os.path.basename(filename))):
                    deploy_file(
                        context, context.build_space,
                        os.path.join(filesDir, os.path.basename(filename)))
                else:
                    self.deploy_files(
                        context,
                        os.path.join(filesDir, os.path.basename(filename)))
Exemple #5
0
    def _install_action_files(self, context):
        # deploy package manifest
        deploy_file(
            context, context.source_space, 'package.xml',
            dst_subfolder=os.path.join('share', context.package_manifest.name))

        # create marker file
        marker_file = os.path.join(
            context.install_space,
            'share', 'ament_index', 'resource_index', 'packages',
            context.package_manifest.name)
        if not os.path.exists(marker_file):
            marker_dir = os.path.dirname(marker_file)
            os.makedirs(marker_dir, exist_ok=True)
            with open(marker_file, 'w'):  # "touching" the file
                pass

        ext = '.sh' if not IS_WINDOWS else '.bat'
        # deploy AMENT_PREFIX_PATH environment hook
        app_template_path = get_environment_hook_template_path('ament_prefix_path' + ext)
        deploy_file(
            context, os.path.dirname(app_template_path), os.path.basename(app_template_path),
            dst_subfolder=os.path.join('share', context.package_manifest.name, 'environment'))

        # deploy PATH environment hook
        path_template_path = get_environment_hook_template_path('path' + ext)
        deploy_file(
            context, os.path.dirname(path_template_path), os.path.basename(path_template_path),
            dst_subfolder=os.path.join('share', context.package_manifest.name, 'environment'))

        # deploy PYTHONPATH environment hook
        destination_file = 'pythonpath' + ('.sh' if not IS_WINDOWS else '.bat')
        deploy_file(
            context, context.build_space,
            os.path.join(
                'share', context.package_manifest.name, 'environment',
                destination_file))

        # deploy package-level setup files
        for name in get_package_level_template_names():
            assert name.endswith('.in')
            deploy_file(
                context, context.build_space,
                os.path.join(
                    'share', context.package_manifest.name, name[:-3]))
    def _install_action_files(self, context):
        # deploy package manifest
        deploy_file(context,
                    context.source_space,
                    'package.xml',
                    dst_subfolder=os.path.join('share',
                                               context.package_manifest.name))

        # create marker file
        marker_file = os.path.join(context.install_space, 'share',
                                   'ament_index', 'resource_index', 'packages',
                                   context.package_manifest.name)
        if not os.path.exists(marker_file):
            marker_dir = os.path.dirname(marker_file)
            if not os.path.exists(marker_dir):
                os.makedirs(marker_dir)
            with open(marker_file, 'w'):  # "touching" the file
                pass

        # deploy PATH environment hook
        ext = '.sh' if not IS_WINDOWS else '.bat'
        template_path = get_environment_hook_template_path('path' + ext)
        deploy_file(context,
                    os.path.dirname(template_path),
                    os.path.basename(template_path),
                    dst_subfolder=os.path.join('share',
                                               context.package_manifest.name,
                                               'environment'),
                    executable=True)

        # deploy PYTHONPATH environment hook
        destination_file = 'pythonpath' + ('.sh' if not IS_WINDOWS else '.bat')
        deploy_file(context,
                    context.build_space,
                    os.path.join('share', context.package_manifest.name,
                                 'environment', destination_file),
                    executable=True)

        # deploy package-level setup files
        for name in get_package_level_template_names():
            assert name.endswith('.in')
            deploy_file(context,
                        context.build_space,
                        os.path.join('share', context.package_manifest.name,
                                     name[:-3]),
                        executable=True)
Exemple #7
0
    def on_install(self, context):
        # First determine the files being deployed with skip_if_exists=True and remove them.
        environment_hooks_path = \
            os.path.join('share', context.package_manifest.name, 'environment')

        environment_hooks_to_be_deployed = []
        environment_hooks = []

        # Prepare to deploy AMENT_PREFIX_PATH environment hook
        ext = '.sh' if not IS_WINDOWS else '.bat'
        ament_prefix_path_template_path = get_environment_hook_template_path(
            'ament_prefix_path' + ext)
        environment_hooks_to_be_deployed.append(
            ament_prefix_path_template_path)
        environment_hooks.append(
            os.path.join(environment_hooks_path, 'ament_prefix_path' + ext))

        # Prepare to deploy PATH environment hook
        ext = '.sh' if not IS_WINDOWS else '.bat'
        path_template_path = get_environment_hook_template_path('path' + ext)
        environment_hooks_to_be_deployed.append(path_template_path)
        environment_hooks.append(
            os.path.join(environment_hooks_path, 'path' + ext))

        # Prepare to deploy library path environment hook if not on Windows
        if not IS_WINDOWS:
            library_template_path = get_environment_hook_template_path(
                'library_path.sh')
            environment_hooks_to_be_deployed.append(library_template_path)
            environment_hooks.append(
                os.path.join(environment_hooks_path, 'library_path.sh'))

        # Expand package level setup files
        destinations = \
            expand_package_level_setup_files(context, environment_hooks, environment_hooks_path)

        # Remove package level setup files so they can be replaced correctly either in the
        # cmake install step or later with deploy_file(..., skip_if_exists=True)
        for destination in destinations:
            destination_path = compute_deploy_destination(
                context, os.path.basename(destination),
                os.path.dirname(
                    os.path.relpath(destination, context.build_space)))
            if os.path.exists(destination_path) or os.path.islink(
                    destination_path):
                os.remove(destination_path)

        # Call cmake common on_install (defined in CmakeBuildType)
        for step in self._common_cmake_on_install(context):
            yield step

        # Install files needed to extend the environment for build dependents to use this package
        # create marker file
        marker_file = os.path.join(context.install_space, 'share',
                                   'ament_index', 'resource_index', 'packages',
                                   context.package_manifest.name)
        if not os.path.exists(marker_file):
            os.makedirs(os.path.dirname(marker_file), exist_ok=True)
            with open(marker_file, 'w'):  # "touching" the file
                pass

        # Deploy environment hooks
        for environment_hook in environment_hooks_to_be_deployed:
            deploy_file(context,
                        os.path.dirname(environment_hook),
                        os.path.basename(environment_hook),
                        dst_subfolder=environment_hooks_path)

        # Expand package-level setup files
        for destination in destinations:
            deploy_file(context,
                        os.path.dirname(destination),
                        os.path.basename(destination),
                        dst_subfolder=os.path.dirname(
                            os.path.relpath(destination, context.build_space)),
                        skip_if_exists=True)
Exemple #8
0
    def on_install(self, context):
        # deploy PATH environment hook
        ext = '.sh' if not IS_WINDOWS else '.bat'
        template_path = get_environment_hook_template_path('path' + ext)
        deploy_file(context,
                    os.path.dirname(template_path),
                    os.path.basename(template_path),
                    dst_subfolder=os.path.join('share',
                                               context.package_manifest.name,
                                               'environment'))

        # deploy JAVAPATH environment hook
        destination_file = 'javapath' + ('.sh' if not IS_WINDOWS else '.bat')
        deploy_file(
            context, context.build_space,
            os.path.join('share', context.package_manifest.name, 'environment',
                         destination_file))

        # create marker file
        marker_file = os.path.join(context.install_space, 'share',
                                   'ament_index', 'resource_index', 'packages',
                                   context.package_manifest.name)
        if not os.path.exists(marker_file):
            marker_dir = os.path.dirname(marker_file)
            if not os.path.exists(marker_dir):
                os.makedirs(marker_dir)
            with open(marker_file, 'w'):  # "touching" the file
                pass

        for name in get_package_level_template_names():
            assert name.endswith('.in')
            deploy_file(
                context, context.build_space,
                os.path.join('share', context.package_manifest.name,
                             name[:-3]))

        cmd_args = [
            '-Pament.build_space=' + context.build_space,
            '-Pament.install_space=' + context.install_space,
            '-Pament.dependencies=' + ':'.join(context.build_dependencies),
            '-Pament.build_tests=' + str(context.build_tests),
        ]

        cmd_args += context.ament_gradle_args

        cmd = [get_gradle_executable(context)]
        cmd += cmd_args
        cmd += ['assemble']

        yield BuildAction(cmd, cwd=context.source_space)

        #Deploy libs dependencies
        filesDir = os.path.join(context.build_space, 'lib', 'java')
        if os.path.exists(filesDir):
            for filename in os.listdir(filesDir):
                deploy_file(
                    context, context.build_space,
                    os.path.join('lib', 'java', os.path.basename(filename)))

        #Deploy share files
        self.deploy_files(
            context,
            os.path.join('share', context.package_manifest.name, 'java'))

        #Deploy scripts
        filesDir = os.path.join(context.build_space, 'bin')
        if os.path.exists(filesDir):
            for filename in os.listdir(filesDir):
                deploy_file(context, context.build_space,
                            os.path.join('bin', os.path.basename(filename)))
Exemple #9
0
    def on_install(self, context):
        # First determine the files being deployed with skip_if_exists=True and remove them.
        environment_hooks_path = \
            os.path.join('share', context.package_manifest.name, 'environment')

        environment_hooks_to_be_deployed = []
        environment_hooks = []

        # Prepare to deploy AMENT_PREFIX_PATH environment hook
        ext = '.sh' if not IS_WINDOWS else '.bat'
        ament_prefix_path_template_path = get_environment_hook_template_path(
            'ament_prefix_path' + ext)
        environment_hooks_to_be_deployed.append(ament_prefix_path_template_path)
        environment_hooks.append(os.path.join(environment_hooks_path, 'ament_prefix_path' + ext))

        # Prepare to deploy PATH environment hook
        ext = '.sh' if not IS_WINDOWS else '.bat'
        path_template_path = get_environment_hook_template_path('path' + ext)
        environment_hooks_to_be_deployed.append(path_template_path)
        environment_hooks.append(os.path.join(environment_hooks_path, 'path' + ext))

        # Prepare to deploy library path environment hook if not on Windows
        if not IS_WINDOWS:
            library_template_path = get_environment_hook_template_path('library_path.sh')
            environment_hooks_to_be_deployed.append(library_template_path)
            environment_hooks.append(os.path.join(environment_hooks_path, 'library_path.sh'))

        # Prepare to deploy PKG_CONFIG_PATH environment hook
        ext = '.sh' if not IS_WINDOWS else '.bat'
        template_path = get_environment_hook_template_path('pkg_config_path' + ext)
        environment_hooks_to_be_deployed.append(template_path)
        environment_hooks.append(os.path.join(environment_hooks_path, 'pkg_config_path' + ext))

        # Expand package level setup files
        destinations = \
            expand_package_level_setup_files(context, environment_hooks, environment_hooks_path)

        # Remove package level setup files so they can be replaced correctly either in the
        # cmake install step or later with deploy_file(..., skip_if_exists=True)
        for destination in destinations:
            destination_path = compute_deploy_destination(
                context,
                os.path.basename(destination),
                os.path.dirname(os.path.relpath(destination, context.build_space)))
            if os.path.exists(destination_path) or os.path.islink(destination_path):
                os.remove(destination_path)

        # Call cmake common on_install (defined in CmakeBuildType)
        for step in self._common_cmake_on_install(context):
            yield step

        # Install files needed to extend the environment for build dependents to use this package
        # create marker file
        marker_file = os.path.join(
            context.install_space,
            'share', 'ament_index', 'resource_index', 'packages',
            context.package_manifest.name)
        if not os.path.exists(marker_file):
            os.makedirs(os.path.dirname(marker_file), exist_ok=True)
            with open(marker_file, 'w'):  # "touching" the file
                pass

        # check if install space has any pkg-config files
        has_pkg_config_files = False
        pkg_config_path = os.path.join(context.install_space, 'lib', 'pkgconfig')
        if os.path.isdir(pkg_config_path):
            for name in os.listdir(pkg_config_path):
                if name.endswith('.pc'):
                    has_pkg_config_files = True
                    break
        if not has_pkg_config_files:
            # remove pkg_config_path hook if not needed
            environment_hooks_to_be_deployed = [
                h for h in environment_hooks_to_be_deployed
                if os.path.splitext(os.path.basename(h))[0] != 'pkg_config_path']
            environment_hooks = [
                h for h in environment_hooks
                if os.path.splitext(os.path.basename(h))[0] != 'pkg_config_path']
            # regenerate package level setup files
            destinations = expand_package_level_setup_files(
                context, environment_hooks, environment_hooks_path)

        # Deploy environment hooks
        for environment_hook in environment_hooks_to_be_deployed:
            deploy_file(
                context, os.path.dirname(environment_hook), os.path.basename(environment_hook),
                dst_subfolder=environment_hooks_path)

        # Expand package-level setup files
        for destination in destinations:
            deploy_file(
                context,
                os.path.dirname(destination), os.path.basename(destination),
                dst_subfolder=os.path.dirname(os.path.relpath(destination, context.build_space)),
                skip_if_exists=True)
Exemple #10
0
    def on_install(self, context):
        # First determine the files being deployed with skip_if_exists=True and remove them.
        environment_hooks_path = \
            os.path.join('share', context.package_manifest.name, 'environment')

        environment_hooks_to_be_deployed = []

        # Prepare to deploy PATH environment hook
        ext = '.sh' if not IS_WINDOWS else '.bat'
        path_template_path = get_environment_hook_template_path('path' + ext)
        environment_hooks_to_be_deployed.append(path_template_path)
        environment_hooks = [os.path.join(environment_hooks_path, 'path' + ext)]

        # Prepare to deploy library path environment hook if not on Windows
        if not IS_WINDOWS:
            library_template_path = get_environment_hook_template_path('library_path.sh')
            environment_hooks_to_be_deployed.append(library_template_path)
            environment_hooks.append(os.path.join(environment_hooks_path, 'library_path.sh'))

        # Expand package level setup files
        destinations = \
            expand_package_level_setup_files(context, environment_hooks, environment_hooks_path)

        # Remove package level setup files so they can be replaced correctly either in the
        # cmake install step or later with deploy_file(..., skip_if_exists=True)
        for destination in destinations:
            destination_path = compute_deploy_destination(
                context,
                os.path.basename(destination),
                os.path.dirname(os.path.relpath(destination, context.build_space))
            )
            if os.path.exists(destination_path) or os.path.islink(destination_path):
                os.remove(destination_path)

        # Call cmake common on_install (defined in CmakeBuildType)
        for step in self._common_cmake_on_install(context):
            yield step

        # Install files needed to extend the environment for build dependents to use this package
        # create marker file
        marker_file = os.path.join(
            context.install_space,
            'share', 'ament_index', 'resource_index', 'packages',
            context.package_manifest.name)
        if not os.path.exists(marker_file):
            marker_dir = os.path.dirname(marker_file)
            if not os.path.exists(marker_dir):
                os.makedirs(marker_dir)
            with open(marker_file, 'w'):  # "touching" the file
                pass

        # Deploy environment hooks
        for environment_hook in environment_hooks_to_be_deployed:
            deploy_file(
                context, os.path.dirname(environment_hook), os.path.basename(environment_hook),
                dst_subfolder=environment_hooks_path)

        # Expand package-level setup files
        for destination in destinations:
            deploy_file(
                context,
                os.path.dirname(destination), os.path.basename(destination),
                dst_subfolder=os.path.dirname(os.path.relpath(destination, context.build_space)),
                skip_if_exists=True)