コード例 #1
0
ファイル: cli.py プロジェクト: ament/ament_tools
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))
コード例 #2
0
ファイル: cli.py プロジェクト: stonier/ament_tools
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))
コード例 #3
0
def expand_prefix_level_setup_files(context):
    # expand prefix-level setup files
    for name in get_prefix_level_template_names():
        if name.endswith('.in'):
            template_path = get_prefix_level_template_path(name)
            content = configure_file(
                template_path, {
                    'CMAKE_INSTALL_PREFIX': context.install_space,
                })
            destination_path = os.path.join(context.build_space, name[:-3])
            with open(destination_path, 'w') as h:
                h.write(content)
コード例 #4
0
ファイル: cli.py プロジェクト: gitter-badger/ament_tools
def expand_prefix_level_setup_files(context):
    # expand prefix-level setup files
    for name in get_prefix_level_template_names():
        if name.endswith('.in'):
            template_path = get_prefix_level_template_path(name)
            content = configure_file(template_path, {
                'CMAKE_INSTALL_PREFIX': context.install_space,
            })
            destination_path = os.path.join(
                context.build_space, name[:-3])
            with open(destination_path, 'w') as h:
                h.write(content)
コード例 #5
0
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]
コード例 #6
0
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]