Exemplo n.º 1
0
def configure(ctx: ConfigurationContext):
    if not hasattr(ctx.options, 'check_c_compiler'):
        raise ConfigurationError(
            'Add configure(ctx): ctx.load(\'compiler_c\')')

    debug_flags = []
    release_flags = []

    if ctx.env.CC_NAME == 'msvc':
        debug_flags = ['/Zi', '/DDEBUG', '/D_DEBUG', '/MDd', '/Od', '/WX']
        release_flags = ['/O2', '/Oi', '/DNDEBUG', '/Gy']
    else:
        debug_flags = ['-ggdb']
        release_flags = ['-O3']

    original_env = ctx.env.derive()
    ctx.setenv('debug', env=ctx.env.derive())
    ctx.env.CFLAGS.extend(debug_flags)

    if ctx.env.CC_NAME == 'msvc':
        ctx.env.LINKFLAGS.append('/DEBUG')

    ctx.setenv('release', env=original_env)

    if '/Od' in ctx.env.CFLAGS:
        ctx.env.CFLAGS.remove('/Od')

    ctx.env.CFLAGS.extend(release_flags)
Exemplo n.º 2
0
def get_afs_sys_name():
    """
    Attempt to get the afs sysname 
    """

    try:
        ret = commands.getstatusoutput('fs sys')
        if ret[0] != 0:
            os.remove('core')
            raise ConfigurationError()
    except:
        raise ConfigurationError('unable to run fs sys')

    at_sys_name = ret[1].split("'")[-2]

    return at_sys_name
Exemplo n.º 3
0
 def check(ast):
     if isinstance(ast, deps_parser.AstSym):
         if (not ast.name.startswith('os-')) and ast.name not in ctx.known_deps:
             raise ConfigurationError(
                 "error in dependencies definition: dependency {0} in"
                 " {1} is unknown.".format(ast.name, depnames))
     elif isinstance(ast, deps_parser.AstOp):
         for sub in ast.sub:
             check(sub)
     else:
         assert False
Exemplo n.º 4
0
def get_out_name_afs():
    """
    Generate an architecture-dependant output file, 
    using the AFS 'fs' tool.
    """

    ret = None

    try:
        ret = commands.getstatusoutput('fs sys')
        if ret[0] != 0:
            os.remove('core')
            raise ConfigurationError()
    except:
        raise ConfigurationError('unable to run fs sys')

    at_sys_name = ret.split("'")[-2]
    out_name = 'build.' + at_sys_name

    return op.join('build', out_name)
Exemplo n.º 5
0
def get_enabled_plugins(conf):
    plugins = get_plugins()
    enabled_plugins = []
    if conf.options.enable_plugins:
        for plugin_name in conf.options.enable_plugins.split(','):
            enabled_plugins.append(plugin_name.strip())
    else:
        skipped_plugins = conf.options.skip_plugins.split(',')
        for plugin_name in plugins:
            if not plugin_name in skipped_plugins:
                enabled_plugins.append(plugin_name)
    if not enabled_plugins:
        raise ConfigurationError('No plugins to compile found')
    return enabled_plugins
Exemplo n.º 6
0
def ensure_dependency_is_known(ctx, *depnames):
    deps = set([d for d in depnames if not d.startswith('os-')])
    if not deps <= ctx.known_deps:
        raise ConfigurationError(
            "error in dependencies definition: some dependencies in"
            " {0} are unknown.".format(deps))
Exemplo n.º 7
0
 def fatal_if_needed(self):
     if self.enabled_option() == False:
         return
     if self.attributes.get('req', False):
         raise ConfigurationError(self.attributes['fmsg'])
Exemplo n.º 8
0
 def fatal_if_needed(self):
     if self.enabled_option() == False:
         return
     if self.attributes.get('req', False):
         raise ConfigurationError(self.attributes.get('fmsg', 'Unsatisfied requirement'))