예제 #1
0
def report_index(report_config=None):
    if report_config is None:
        report_config = ReportConfig()

    reports_base_path = report_config.reports_base_path
    reports = []
    for report_path in iter_report_dirs(reports_base_path):

        fn = op.join(report_path, 'index.yaml')
        if not os.path.exists(fn):
            logger.warn('Skipping indexing of incomplete report: %s' %
                        report_path)

            continue

        logger.info('Indexing %s...' % report_path)

        rie = guts.load(filename=fn)
        report_relpath = op.relpath(report_path, reports_base_path)
        rie.path = report_relpath
        reports.append(rie)

    guts.dump_all(reports,
                  filename=op.join(reports_base_path, 'report_list.yaml'))

    from grond import info
    guts.dump(info.version_info(),
              filename=op.join(reports_base_path, 'version_info.yaml'))

    app_dir = op.join(op.split(__file__)[0], 'app')
    copytree(app_dir, reports_base_path)
    logger.info('Created report in %s/index.html' % reports_base_path)
예제 #2
0
def report_index(report_config=None):
    if report_config is None:
        report_config = ReportConfig()

    report_base_path = report_config.report_base_path
    entries = []
    for entry_path in iter_report_entry_dirs(report_base_path):

        fn = op.join(entry_path, 'index.yaml')
        if not os.path.exists(fn):
            logger.warn('Skipping indexing of incomplete report entry: %s' %
                        entry_path)

            continue

        logger.info('Indexing %s...' % entry_path)

        rie = guts.load(filename=fn)
        report_relpath = op.relpath(entry_path, report_base_path)
        rie.path = report_relpath
        entries.append(rie)

    guts.dump_all(entries,
                  filename=op.join(report_base_path, 'report_list.yaml'))

    guts.dump(ReportInfo(title=report_config.title,
                         description=report_config.description,
                         version_info=info.version_info(),
                         have_archive=report_config.make_archive),
              filename=op.join(report_base_path, 'info.yaml'))

    app_dir = op.join(op.split(__file__)[0], 'app')
    copytree(app_dir, report_base_path)
    logger.info('Created report in %s/index.html' % report_base_path)
예제 #3
0
def command_version(args):
    def setup(parser):
        parser.add_option(
            '--short', dest='short', action='store_true',
            help='only print Grond\'s version number')
        parser.add_option(
            '--failsafe', dest='failsafe', action='store_true',
            help='do not get irritated when some dependencies are missing')

    parser, options, args = cl_parse('version', args, setup)

    if options.short:
        print(grond.__version__)
        return

    elif not options.failsafe:
        from grond import info
        print(info.version_info())
        return

    print("grond: %s" % grond.__version__)

    try:
        import pyrocko
        print('pyrocko: %s' % pyrocko.long_version)
    except ImportError:
        print('pyrocko: N/A')

    try:
        import numpy
        print('numpy: %s' % numpy.__version__)
    except ImportError:
        print('numpy: N/A')

    try:
        import scipy
        print('scipy: %s' % scipy.__version__)
    except ImportError:
        print('scipy: N/A')

    try:
        import matplotlib
        print('matplotlib: %s' % matplotlib.__version__)
    except ImportError:
        print('matplotlib: N/A')

    try:
        from pyrocko.gui.qt_compat import Qt
        print('PyQt: %s' % Qt.PYQT_VERSION_STR)
        print('Qt: %s' % Qt.QT_VERSION_STR)
    except ImportError:
        print('PyQt: N/A')
        print('Qt: N/A')

    import sys
    print('python: %s.%s.%s' % sys.version_info[:3])

    if not options.failsafe:
        die('fell back to failsafe version printing')