Exemple #1
0
def __main__(args=None):
    conf = pydwarf.config.load(args=args.__dict__)
    pydwarf.log.debug('Proceeding with configuration: %s.' % conf)

    # Report versions
    pydwarf.log.info('Running PyDwarf manager version %s.' % __version__)
    pydwarf.log.debug('With pydwarf version %s.' % pydwarf.__version__)
    pydwarf.log.debug('With raws version %s.' % raws.__version__)
    pydwarf.log.debug('With Dwarf Fortress version %s.' % conf.version)
    pydwarf.log.debug('With DFHack version %s.' % conf.hackversion)

    # Handle flags that completely change behavior
    specialtext = None

    if args.list:
        scripts = pydwarf.urist.list()
        specialtext = '\n'.join(str(script) for script in scripts)
    elif args.meta is not None:
        specialtext = pydwarf.urist.doclist(args.meta, format=args.metaformat)

    if specialtext is not None:
        pydwarf.log.info('\n\n%s\n' % specialtext)
        if args.writedoc:
            with open(args.writedoc, 'wb') as writedoc:
                writedoc.write(specialtext)
        exit(0)

    # Create a new session and run it
    pydwarf.log.info('Configuring session using raws input directory %s.' %
                     conf.input)
    session = pydwarf.session(raws, conf)
    session.run()

    # All done!
    pydwarf.log.info('All done!')
Exemple #2
0
def __main__(args=None):
    conf = pydwarf.config.load(args=args.__dict__)
    pydwarf.log.debug('Proceeding with configuration: %s.' % conf)
    
    # Report versions
    pydwarf.log.info('Running PyDwarf manager version %s.' % __version__)
    pydwarf.log.debug('With pydwarf version %s.' % pydwarf.__version__)
    pydwarf.log.debug('With raws version %s.' % raws.__version__)
    pydwarf.log.debug('With Dwarf Fortress version %s.' % conf.version)
    pydwarf.log.debug('With DFHack version %s.' % conf.hackversion)
    
    # Handle flags that completely change behavior
    specialtext = None
    
    if args.list:
        scripts = pydwarf.urist.list()
        specialtext = '\n'.join(str(script) for script in scripts)
    elif args.meta is not None:
        specialtext = pydwarf.urist.doclist(args.meta, format=args.metaformat)
    
    if specialtext is not None:
        pydwarf.log.info('\n\n%s\n' % specialtext)
        if args.writedoc:
            with open(args.writedoc, 'wb') as writedoc: writedoc.write(specialtext)
        exit(0)
    
    # Create a new session and run it
    pydwarf.log.info('Configuring session using raws input directory %s.' % conf.input)
    session = pydwarf.session(raws, conf)
    session.run()
    
    # All done!
    pydwarf.log.info('All done!')
Exemple #3
0
        'Exception raised:\n'
            '(?P<exception>.*)'
    ')'
    '\s*$'
)
doctest_result_re = re.compile(doctest_pattern)



if __name__ == '__main__':
    print('Initializing session.')
    conf = pydwarf.config.load(root=pydwarf_root, args={
        'log': '',
        'verbose': False,
    })
    session = pydwarf.session(raws, conf)
    
    print('Running examples.')
    results = verify(
        examples,
        df = session.df,
        raws = raws,
        pydwarf = pydwarf,
        session = session,
        conf = conf
    )
    
    realresults = []
    lastfailurein = None
    for result in results:
        match = doctest_result_re.match(result.expandtabs(4))