Пример #1
0
def loop_part(part, level=0, record=True):
    chk = lm.find.chk(part)
    cstep, tstep = analyze_chk(chk)

    if not tstep:
        inp = lm.find.inp(part)
        tstep = get_tstep(inp)

    if not tstep:
        parm = lm.find.parm(part)
        tstep = get_tstep(parm)

    if not cstep:
        dat = lm.find.dat(part)
        cstep = analyze_dat(dat)

    percent, done = get_percent(cstep, tstep)

    if not tstep:
        tstep = '?'

    if not cstep:
        cstep = '?'

    if not done:
        if record:
            results['not_done'].append(part)
        done = ccodes.red('%s' % done)
    else:
        if record:
            results['done'].append(part)
        done = ccodes.green('%s' % done)

    indent(format_string, level=level, path=os.path.basename(part), cstep=cstep,
           tstep=tstep, percent=percent, done=done)
Пример #2
0
def loop_part(part, level=0, record=True):
    chk = lm.find.chk(part)
    cstep, tstep = analyze_chk(chk)

    if not tstep:
        inp = lm.find.inp(part)
        tstep = get_tstep(inp)

    if not tstep:
        parm = lm.find.parm(part)
        tstep = get_tstep(parm)

    if not cstep:
        dat = lm.find.dat(part)
        cstep = analyze_dat(dat)

    percent, done = get_percent(cstep, tstep)

    if not tstep:
        tstep = '?'

    if not cstep:
        cstep = '?'

    if not done:
        if record:
            results['not_done'].append(part)
        done = ccodes.red('%s' % done)
    else:
        if record:
            results['done'].append(part)
        done = ccodes.green('%s' % done)

    indent(format_string,
           level=level,
           path=os.path.basename(part),
           cstep=cstep,
           tstep=tstep,
           percent=percent,
           done=done)
Пример #3
0
    all_parts, last_parts = lm.find.parts(work, r=opts.r), []
    for sim, parts in itertools.groupby(all_parts, key=lambda x : os.path.dirname(x)):
        parts = [part for part in parts]
        parts.sort(key=lm.regex.numbers)
        last_parts.append(parts[-1])
    parts = last_parts

    if not parts:
        chk = lm.find.chk(work)
        try:
            parts = [lm.find.slice_part(work)]
        except AssertionError:
            parts = []

    if not parts:
        print ccodes.red('error: can not find any parts, try using -r')
        sys.exit(-1)

    new_parts, errors = [], 0
    for i, part in enumerate(parts):
        if i > 0:
            print ''

        part_relpath = os.path.relpath(part, work)
        print ccodes.yellow('found: ' +  part_relpath)

        chk = lm.find.chk(part)
        if not chk:
            print ccodes.red('error:') + ' ' + ccodes.blue('can not find chk!')
            errors += 1
            continue
Пример #4
0
    for sim, parts in itertools.groupby(all_parts,
                                        key=lambda x: os.path.dirname(x)):
        parts = [part for part in parts]
        parts.sort(key=lm.regex.numbers)
        last_parts.append(parts[-1])
    parts = last_parts

    if not parts:
        chk = lm.find.chk(work)
        try:
            parts = [lm.find.slice_part(work)]
        except AssertionError:
            parts = []

    if not parts:
        print ccodes.red('error: can not find any parts, try using -r')
        sys.exit(-1)

    new_parts, errors = [], 0
    for i, part in enumerate(parts):
        if i > 0:
            print ''

        part_relpath = os.path.relpath(part, work)
        print ccodes.yellow('found: ' + part_relpath)

        chk = lm.find.chk(part)
        if not chk:
            print ccodes.red('error:') + ' ' + ccodes.blue('can not find chk!')
            errors += 1
            continue