Exemplo n.º 1
0
def handleOption(e):
    errors.pushCtx("when processing option '%s' at %s" %
                   (e.name, e.location()))

    name = evalConstExpr(e, e.props['name'])
    if name in mk.options:
        raise ReaderError(e, "option '%s' already defined" % name)

    if name in mk.override_vars:
        return  # user hardcoded the value with -D=xxx

    default = None
    force_default = False
    desc = None
    values = None
    values_desc = None
    category = mk.Option.CATEGORY_UNSPECIFICED
    for c in e.children:
        if c.name == 'default-value':
            default = c.value
            force_default = 'force' in c.props and c.props['force'] == '1'
        elif c.name == 'description':
            desc = c.value
        elif c.name == 'values':
            values = evalConstExpr(e, c.value.replace('\n', '')).split(',')
            for i in range(len(values)):
                values[i] = values[i].strip()
        elif c.name == 'values-description':
            values_desc = evalConstExpr(e, c.value).split(',')

    o = mk.Option(name, default, force_default, desc, values, values_desc,
                  errors.getCtx())
    mk.addOption(o)

    if 'never_empty' in e.props and e.props['never_empty'] == '1':
        o.neverEmpty = 1

    if 'category' in e.props:
        category = evalConstExpr(e, e.props['category'])
        if category == mk.Option.CATEGORY_PATH:
            o.category = category
            o.neverEmpty = 1

            def __pathOptionCallb(var, func, caller):
                if caller == 'nativePaths':
                    return '$(%s)' % var
                else:
                    return None

            utils.addSubstituteCallback(o.name, __pathOptionCallb)
        else:
            raise ReaderError(e, "unknown category '%s'" % category)

    errors.popCtx()
Exemplo n.º 2
0
def handleOption(e):
    errors.pushCtx("when processing option '%s' at %s" %
                   (e.name, e.location()))

    name = evalConstExpr(e, e.props['name'])
    if name in mk.options:
        raise ReaderError(e, "option '%s' already defined" % name)

    if name in mk.override_vars:
        return # user hardcoded the value with -D=xxx

    default = None
    force_default = False
    desc = None
    values = None
    values_desc = None
    category = mk.Option.CATEGORY_UNSPECIFICED
    for c in e.children:
        if c.name == 'default-value':
            default = c.value
            force_default = 'force' in c.props and c.props['force'] == '1'
        elif c.name == 'description':
            desc = c.value
        elif c.name == 'values':
            values = evalConstExpr(e, c.value.replace('\n','')).split(',')
            for i in range(len(values)):
                values[i] = values[i].strip()
        elif c.name == 'values-description':
            values_desc = evalConstExpr(e, c.value).split(',')

    o = mk.Option(name, default, force_default, desc, values, values_desc,
                  errors.getCtx())
    mk.addOption(o)
    
    if 'never_empty' in e.props and e.props['never_empty'] == '1':
        o.neverEmpty = 1

    if 'category' in e.props:
        category = evalConstExpr(e, e.props['category'])
        if category == mk.Option.CATEGORY_PATH:
            o.category = category
            o.neverEmpty = 1
            def __pathOptionCallb(var, func, caller):
                if caller == 'nativePaths':
                    return '$(%s)' % var
                else:
                    return None
            utils.addSubstituteCallback(o.name, __pathOptionCallb)
        else:
            raise ReaderError(e, "unknown category '%s'" % category)

    errors.popCtx()
Exemplo n.º 3
0
import utils

# We use 'CFG' option in places where bakefile doesn't like it, so we must
# register a substitution function for it that provides additional knowledge
# about the option (in this case that it does not contain dir separators and
# so utils.nativePaths() doesn't have to do anything with it):

try:
    # this fails in 0.1.4 and 0.1.5 has different subst.callbacks signature:
    utils.checkBakefileVersion('0.1.5') 
    def __noopSubst(name, func, caller):
        return '$(%s)' % name
except AttributeError:
    def __noopSubst(func, name):
        return '$(%s)' % name
utils.addSubstituteCallback('CFG', __noopSubst)
utils.addSubstituteCallback('LIBDIRNAME', __noopSubst)
utils.addSubstituteCallback('SETUPHDIR', __noopSubst)
utils.addSubstituteCallback('OBJS', __noopSubst)


def mk_wxid(id):
    """Creates wxWidgets library identifier from bakefile target ID that
       follows this convention: DLLs end with 'dll', static libraries
       end with 'lib'. If withPrefix=1, then _wxid is returned instead
       of wxid."""
    if id.endswith('dll') or id.endswith('lib'):
        wxid = id[:-3]
    else:
        wxid = id
    return wxid
Exemplo n.º 4
0
# about the option (in this case that it does not contain dir separators and
# so utils.nativePaths() doesn't have to do anything with it):

try:
    # this fails in 0.1.4 and 0.1.5 has different subst.callbacks signature:
    utils.checkBakefileVersion('0.1.5')

    def __noopSubst(name, func, caller):
        return '$(%s)' % name
except AttributeError:

    def __noopSubst(func, name):
        return '$(%s)' % name


utils.addSubstituteCallback('CFG', __noopSubst)
utils.addSubstituteCallback('LIBDIRNAME', __noopSubst)
utils.addSubstituteCallback('SETUPHDIR', __noopSubst)
utils.addSubstituteCallback('OBJS', __noopSubst)


def mk_wxid(id):
    """Creates wxWidgets library identifier from bakefile target ID that
       follows this convention: DLLs end with 'dll', static libraries
       end with 'lib'. If withPrefix=1, then _wxid is returned instead
       of wxid."""
    if id.endswith('dll') or id.endswith('lib'):
        wxid = id[:-3]
    else:
        wxid = id
    return wxid
Exemplo n.º 5
0
# We use 'COMPILER_PREFIX' option in places where bakefile doesn't like it, so
# we must register a substitution function for it that provides additional
# knowledge about the option (in this case that it does not contain dir
# separators and so utils.nativePaths() doesn't have to do anything with it):

from utils import addSubstituteCallback


def __noopSubst(name, func, caller):
    return "$(%s)" % name


addSubstituteCallback("COMPILER_PREFIX", __noopSubst)
Exemplo n.º 6
0
try:
    # this fails in 0.1.4 and 0.1.5 has different subst.callbacks signature:
    utils.checkBakefileVersion("0.1.5")

    def __noopSubst(name, func, caller):
        return "$(%s)" % name


except AttributeError:

    def __noopSubst(func, name):
        return "$(%s)" % name


utils.addSubstituteCallback("CFG", __noopSubst)
utils.addSubstituteCallback("LIBDIRNAME", __noopSubst)
utils.addSubstituteCallback("SETUPHDIR", __noopSubst)
utils.addSubstituteCallback("OBJS", __noopSubst)


def mk_wxid(id):
    """Creates wxWidgets library identifier from bakefile target ID that
       follows this convention: DLLs end with 'dll', static libraries
       end with 'lib'. If withPrefix=1, then _wxid is returned instead
       of wxid."""
    if id.endswith("dll") or id.endswith("lib"):
        wxid = id[:-3]
    else:
        wxid = id
    return wxid
Exemplo n.º 7
0
# We use 'COMPILER_PREFIX' option in places where bakefile doesn't like it, so
# we must register a substitution function for it that provides additional
# knowledge about the option (in this case that it does not contain dir
# separators and so utils.nativePaths() doesn't have to do anything with it):

from utils import addSubstituteCallback

def __noopSubst(name, func, caller):
    return '$(%s)' % name
addSubstituteCallback('COMPILER_PREFIX', __noopSubst)
Exemplo n.º 8
0
# We use 'COMPILER_PREFIX' option in places where bakefile doesn't like it, so
# we must register a substitution function for it that provides additional
# knowledge about the option (in this case that it does not contain dir
# separators and so utils.nativePaths() doesn't have to do anything with it):

from utils import addSubstituteCallback

def __noopSubst(name, func, caller):
    return '$(%s)' % name
addSubstituteCallback('COMPILER_PREFIX', __noopSubst)