Exemplo n.º 1
0
import os

from sca.codegen.jinja.loader import CodegenLoader
from sca.codegen.jinja.common import ShellTemplate, AutomakeTemplate, AutoconfTemplate, PkgconfigTemplate
from sca.codegen.jinja.cpp import CppCodeGenerator, CppTemplate
from sca.codegen.jinja.mapping import SoftpkgMapper

from sca.codegen.lang.automake import libtoolName

if not '__package__' in locals():
    # Python 2.4 compatibility
    __package__ = __name__.rsplit('.', 1)[0]

loader = CodegenLoader(
    __package__, {
        'common': 'sca.codegen.jinja.common',
        'base': 'sca.codegen.jinja.cpp.component.base'
    })


class CppLibraryMapper(SoftpkgMapper):
    def _mapComponent(self, softpkg):
        cpplib = {}
        libname = softpkg.basename()
        cpplib['libname'] = libname
        cpplib['ltlibname'] = libtoolName(libname)
        cpplib['incfile'] = libname + '.h'
        cpplib['srcfile'] = libname + '.cpp'
        cpplib['pcfile'] = softpkg.name() + '.pc'
        return cpplib
Exemplo n.º 2
0
from sca.codegen.jinja.common import ShellTemplate, SpecfileTemplate
from sca.codegen.jinja.generator import TopLevelGenerator
from sca.codegen.jinja.loader import CodegenLoader
from mapping import DependencyProjectMapper

if not '__package__' in locals():
    # Python 2.4 compatibility
    __package__ = __name__.rsplit('.', 1)[0]

loader = CodegenLoader(__package__)


class DependencyProjectGenerator(TopLevelGenerator):
    def loader(self, project):
        return loader

    def templates(self, project):
        return [
            ShellTemplate('build.sh'),
            SpecfileTemplate('dependency.spec', project['specfile'])
        ]

    def projectMapper(self):
        return DependencyProjectMapper()
Exemplo n.º 3
0
from sca.codegen.jinja.common import ShellTemplate, AutomakeTemplate, AutoconfTemplate
from sca.codegen.jinja.loader import CodegenLoader
from sca.codegen.jinja.template import TemplateFile
from sca.codegen.jinja.cpp import CppTemplate
from sca.codegen import versions

from mapping import MFunctionMapper

if not '__package__' in locals():
    # Python 2.4 compatibility
    __package__ = __name__.rsplit('.', 1)[0]

loader = CodegenLoader(
    __package__, {
        'pull': 'sca.codegen.jinja.cpp.component.pull',
        'mFunction': 'sca.codegen.jinja.cpp.component.mFunction',
        'common': 'sca.codegen.jinja.common',
        'properties': 'sca.codegen.jinja.cpp.properties',
        'base': 'sca.codegen.jinja.cpp.component.base'
    })


class OctaveComponentGenerator(PullComponentGenerator):
    '''
    A generator that is very similar to the C++ pull generator.  This generator 
    differs form its parent in 4 primary regards:

        1. The octaveResource.cpp/octaveResource_base.cpp/octaveResource.h/
           octaveResource_base.h are used in alternative to resource.cpp/
           resource_base.cpp/resource.h/resource_base.h.  A custom main.cpp
           is also used.
Exemplo n.º 4
0
from sca.codegen.jinja.common import ShellTemplate, AutomakeTemplate, AutoconfTemplate
from sca.codegen.jinja.python import PythonTemplate
from sca.codegen.jinja.python.properties import PythonPropertyMapper
from sca.codegen.jinja.python.ports import PythonPortMapper
from sca.codegen.jinja.python.component.frontend.portfactory import FEIPortFactory
from sca.codegen.jinja.python.component.pull import PullComponentGenerator

from mapping import BinaryComponentMapper

if not '__package__' in locals():
    # Python 2.4 compatibility
    __package__ = __name__.rsplit('.', 1)[0]

loader = CodegenLoader(
    __package__, {
        'common': 'sca.codegen.jinja.common',
        'pull': 'sca.codegen.jinja.python.component.pull',
        'base': 'sca.codegen.jinja.python.component.base'
    })


class BinaryComponentGenerator(PullComponentGenerator):
    # Need to keep auto_start and queued_ports to handle legacy options
    def parseopts(self,
                  auto_start=True,
                  queued_ports=False,
                  legacy_structs=True):
        self.legacy_structs = utils.parseBoolean(legacy_structs)

    def loader(self, component):
        return loader
Exemplo n.º 5
0
from sca.codegen.jinja.loader import CodegenLoader
from sca.codegen.jinja.common import ShellTemplate, AutomakeTemplate, AutoconfTemplate
from sca.codegen.jinja.cpp import CppCodeGenerator, CppTemplate

from mapping import BaseComponentMapper

if not '__package__' in locals():
    # Python 2.4 compatibility
    __package__ = __name__.rsplit('.', 1)[0]

loader = CodegenLoader(__package__, {'common': 'sca.codegen.jinja.common'})


class BaseComponentGenerator(CppCodeGenerator):
    def loader(self, component):
        return loader

    def componentMapper(self):
        return BaseComponentMapper()

    def propertyMapper(self):
        return None

    def portMapper(self):
        return None

    def templates(self, component):
        templates = [
            CppTemplate('main.cpp'),
            AutomakeTemplate('Makefile.am'),
            AutomakeTemplate('Makefile.am.ide'),