How to use the mk.options.values function in mk

To help you get started, we’ve selected a few mk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vslavik / bakefile / src / mk_dump.py View on Github external
def dumpMakefile():
    print '\nVariables:'
    for v in mk.vars:
        print '  %-30s = %s' % (v, mk.vars[v])

    print '\nOptions:'
    for o in mk.options.values():
        print '  %-30s (default:%s,values:%s)' % (o.name, o.default, o.values)

    print '\nConditions:'
    for c in mk.conditions.values():
        print '  %-30s (%s)' % (c.name,c.exprs)

    print '\nConditional variables:'
    for v in mk.cond_vars.values():
        print '  %-30s' % v.name
        for vv in v.values:
            print '    if %-25s = %s' % (vv.cond.name, vv.value)

    print '\nTargets:'
    for t in mk.targets.values():
        print '  %s %s' % (t.type, t.id)
        for v in t.vars:
github vslavik / bakefile / src / finalize.py View on Github external
def _repl(s):
        return s.replace('$', '$')

    if config.verbose:
        print 'replacing escape sequences'
    for v in mk.vars:
        if type(mk.vars[v]) is StringType:
            mk.vars[v] = _repl(mk.vars[v])
    for v in mk.make_vars:
        mk.make_vars[v] = _repl(mk.make_vars[v])
    for t in mk.targets.values():
        for v in t.vars:
            if type(t.vars[v]) is StringType:
                t.vars[v] = _repl(t.vars[v])
    for o in mk.options.values():
        if o.default != None:
            o.default = _repl(o.default)
        if o.values != None:
            o.values = [_repl(x) for x in o.values]

    for c in mk.cond_vars.values():
        for v in c.values:
            v.value = _repl(v.value)
github vslavik / bakefile / src / flatten.py View on Github external
if i1 != i2:
                return i1-i2
        return 0
    cfgs = [x.values for x in makeConfigs()]
    cfgs.sort(__configCompare)
    if len(cfgs) == 0:
        cfgs = [{}]

    if config.verbose:
        print '%i configurations' % len(cfgs)
        if config.debug:
            for c in cfgs: print '[dbg] %s' % c

    # remove options and conditional variables:
    mk.__vars_opt = {}
    for opt in mk.options.values():
        if opt.values == None:
            mk.vars[opt.name] = opt.default

    # add target.configs dictionary:
    for t in mk.targets.values():
        t.vars['configs'] = {}

    # expand or configurations:
    configs = {}
    configs_order = []
    for c in cfgs:
        name = __cfg2str(c)
        configDefs[name] = c
        configs[name] = flattenConfig(c)
        configs_order.append(name)
    mk.vars['configs'] = configs