Exemple #1
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 #2
0
    def _build_action(self, context):
        environment_hooks_path = os.path.join('share',
                                              context.package_manifest.name,
                                              'environment')

        ext = '.sh' if not IS_WINDOWS else '.bat'
        path_environment_hook = os.path.join(environment_hooks_path,
                                             'path' + ext)
        # expand environment hook for PYTHONPATH
        ext = '.sh.in' if not IS_WINDOWS else '.bat.in'
        template_path = get_environment_hook_template_path('pythonpath' + ext)
        content = configure_file(
            template_path, {
                'PYTHON_INSTALL_DIR': self._get_python_lib(context),
            })
        pythonpath_environment_hook = os.path.join(
            environment_hooks_path,
            os.path.basename(template_path)[:-3])
        destination_path = os.path.join(context.build_space,
                                        pythonpath_environment_hook)
        destination_dir = os.path.dirname(destination_path)
        if not os.path.exists(destination_dir):
            os.makedirs(destination_dir)
        with open(destination_path, 'w') as h:
            h.write(content)

        environment_hooks = [
            path_environment_hook,
            pythonpath_environment_hook,
        ]

        # expand package-level setup files
        expand_package_level_setup_files(context, environment_hooks,
                                         environment_hooks_path)
Exemple #3
0
    def _build_action(self, context):
        environment_hooks_path = os.path.join(
            'share', context.package_manifest.name, 'environment')

        ext = '.sh' if not IS_WINDOWS else '.bat'
        path_environment_hook = os.path.join(
            environment_hooks_path, 'path' + ext)
        # expand environment hook for PYTHONPATH
        ext = '.sh.in' if not IS_WINDOWS else '.bat.in'
        template_path = get_environment_hook_template_path('pythonpath' + ext)
        content = configure_file(template_path, {
            'PYTHON_INSTALL_DIR': self._get_python_lib(context),
        })
        pythonpath_environment_hook = os.path.join(
            environment_hooks_path, os.path.basename(template_path)[:-3])
        destination_path = os.path.join(
            context.build_space, pythonpath_environment_hook)
        destination_dir = os.path.dirname(destination_path)
        if not os.path.exists(destination_dir):
            os.makedirs(destination_dir)
        with open(destination_path, 'w') as h:
            h.write(content)

        environment_hooks = [
            path_environment_hook,
            pythonpath_environment_hook,
        ]

        # expand package-level setup files
        expand_package_level_setup_files(context, environment_hooks, environment_hooks_path)
def generate_cmake_code():
    """
    Return a list of CMake set() commands containing the template information.

    :returns: list of str
    """
    variables = []

    if not IS_WINDOWS:
        variables.append((
            'ENVIRONMENT_HOOK_LIBRARY_PATH',
            '"%s"' % get_environment_hook_template_path('library_path.sh')))
    else:
        variables.append(('ENVIRONMENT_HOOK_LIBRARY_PATH', ''))

    ext = '.bat.in' if IS_WINDOWS else '.sh.in'
    variables.append((
        'ENVIRONMENT_HOOK_PYTHONPATH',
        '"%s"' % get_environment_hook_template_path('pythonpath' + ext)))

    templates = []
    for name in get_package_level_template_names():
        templates.append('"%s"' % get_package_level_template_path(name))
    variables.append((
        'PACKAGE_LEVEL',
        templates))

    templates = []
    for name in get_prefix_level_template_names():
        templates.append('"%s"' % get_prefix_level_template_path(name))
    variables.append((
        'PREFIX_LEVEL',
        templates))

    lines = []
    for (k, v) in variables:
        if isinstance(v, list):
            lines.append('set(ament_cmake_package_templates_%s "")' % k)
            for vv in v:
                lines.append('list(APPEND ament_cmake_package_templates_%s %s)'
                             % (k, vv))
        else:
            lines.append('set(ament_cmake_package_templates_%s %s)' % (k, v))
    # Ensure backslashes are replaced with forward slashes because CMake cannot
    # parse files with backslashes in it.
    return [l.replace('\\', '/') for l in lines]
def generate_cmake_code():
    """
    Return a list of CMake set() commands containing the template information.

    :returns: list of str
    """
    variables = []

    if not IS_WINDOWS:
        variables.append((
            'ENVIRONMENT_HOOK_LIBRARY_PATH',
            '"%s"' % get_environment_hook_template_path('library_path.sh')))
    else:
        variables.append(('ENVIRONMENT_HOOK_LIBRARY_PATH', ''))

    ext = '.bat.in' if IS_WINDOWS else '.sh.in'
    variables.append((
        'ENVIRONMENT_HOOK_PYTHONPATH',
        '"%s"' % get_environment_hook_template_path('pythonpath' + ext)))

    templates = []
    for name in get_package_level_template_names():
        templates.append('"%s"' % get_package_level_template_path(name))
    variables.append((
        'PACKAGE_LEVEL',
        templates))

    templates = []
    for name in get_prefix_level_template_names():
        templates.append('"%s"' % get_prefix_level_template_path(name))
    variables.append((
        'PREFIX_LEVEL',
        templates))

    lines = []
    for (k, v) in variables:
        if isinstance(v, list):
            lines.append('set(ament_cmake_package_templates_%s "")' % k)
            for vv in v:
                lines.append('list(APPEND ament_cmake_package_templates_%s %s)'
                             % (k, vv))
        else:
            lines.append('set(ament_cmake_package_templates_%s %s)' % (k, v))
    # Ensure backslashes are replaced with forward slashes because CMake cannot
    # parse files with backslashes in it.
    return [l.replace('\\', '/') for l in lines]
Exemple #6
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 _build_action(self, context):
        ext = '.sh' if not IS_WINDOWS else '.bat'
        path_environment_hook = os.path.join('share',
                                             context.package_manifest.name,
                                             'environment', 'path' + ext)
        # expand environment hook for PYTHONPATH
        ext = '.sh.in' if not IS_WINDOWS else '.bat.in'
        template_path = get_environment_hook_template_path('pythonpath' + ext)
        content = configure_file(
            template_path, {
                'PYTHON_INSTALL_DIR': self._get_python_lib(context),
            })
        pythonpath_environment_hook = os.path.join(
            'share', context.package_manifest.name, 'environment',
            os.path.basename(template_path)[:-3])
        destination_path = os.path.join(context.build_space,
                                        pythonpath_environment_hook)
        destination_dir = os.path.dirname(destination_path)
        if not os.path.exists(destination_dir):
            os.makedirs(destination_dir)
        with open(destination_path, 'w') as h:
            h.write(content)

        # expand package-level setup files
        for name in get_package_level_template_names():
            assert name.endswith('.in')
            template_path = get_package_level_template_path(name)
            variables = {'CMAKE_INSTALL_PREFIX': context.install_space}
            if name[:-3].endswith('.sh'):
                variables['ENVIRONMENT_HOOKS'] = \
                    'ament_append_value AMENT_ENVIRONMENT_HOOKS "%s"\n' % \
                    ':'.join([
                        os.path.join('$AMENT_CURRENT_PREFIX', path_environment_hook),
                        os.path.join('$AMENT_CURRENT_PREFIX', pythonpath_environment_hook),
                    ])
            elif name[:-3].endswith('.bat'):
                t = 'call:ament_append_value AMENT_ENVIRONMENT_HOOKS[%s] "%s"\n'
                variables['ENVIRONMENT_HOOKS'] = t % (
                    context.package_manifest.name, ';'.join([
                        os.path.join('%AMENT_CURRENT_PREFIX%',
                                     path_environment_hook),
                        os.path.join('%AMENT_CURRENT_PREFIX%',
                                     pythonpath_environment_hook),
                    ]))
                variables['PROJECT_NAME'] = context.package_manifest.name
            content = configure_file(template_path, variables)
            destination_path = os.path.join(context.build_space, 'share',
                                            context.package_manifest.name,
                                            name[:-3])
            with open(destination_path, 'w') as h:
                h.write(content)
    def _build_action(self, context):
        ext = '.sh' if not IS_WINDOWS else '.bat'
        path_environment_hook = os.path.join(
            'share', context.package_manifest.name, 'environment', 'path' + ext)
        # expand environment hook for PYTHONPATH
        ext = '.sh.in' if not IS_WINDOWS else '.bat.in'
        template_path = get_environment_hook_template_path('pythonpath' + ext)
        content = configure_file(template_path, {
            'PYTHON_INSTALL_DIR': self._get_python_lib(context),
        })
        pythonpath_environment_hook = os.path.join(
            'share', context.package_manifest.name, 'environment',
            os.path.basename(template_path)[:-3])
        destination_path = os.path.join(
            context.build_space, pythonpath_environment_hook)
        destination_dir = os.path.dirname(destination_path)
        if not os.path.exists(destination_dir):
            os.makedirs(destination_dir)
        with open(destination_path, 'w') as h:
            h.write(content)

        # expand package-level setup files
        for name in get_package_level_template_names():
            assert name.endswith('.in')
            template_path = get_package_level_template_path(name)
            variables = {'CMAKE_INSTALL_PREFIX': context.install_space}
            if name[:-3].endswith('.sh'):
                variables['ENVIRONMENT_HOOKS'] = \
                    'ament_append_value AMENT_ENVIRONMENT_HOOKS "%s"\n' % \
                    ':'.join([
                        os.path.join('$AMENT_CURRENT_PREFIX', path_environment_hook),
                        os.path.join('$AMENT_CURRENT_PREFIX', pythonpath_environment_hook),
                    ])
            elif name[:-3].endswith('.bat'):
                t = 'call:ament_append_value AMENT_ENVIRONMENT_HOOKS[%s] "%s"\n'
                variables['ENVIRONMENT_HOOKS'] = t % (
                    context.package_manifest.name,
                    ';'.join([
                        os.path.join('%AMENT_CURRENT_PREFIX%', path_environment_hook),
                        os.path.join('%AMENT_CURRENT_PREFIX%', pythonpath_environment_hook),
                    ])
                )
                variables['PROJECT_NAME'] = context.package_manifest.name
            content = configure_file(template_path, variables)
            destination_path = os.path.join(
                context.build_space,
                'share', context.package_manifest.name,
                name[:-3])
            with open(destination_path, 'w') as h:
                h.write(content)
    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 #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 = []
        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 #11
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 #12
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 #13
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)