def main(): logging.basicConfig(level=logging.INFO) judgeenv.env['runtime'] = {} judgeenv.env['extra_fs'] = {} print('Testing executors...') ci_test(get_available(), OVERRIDES, ALLOW_FAIL)
def main(): result = {} if os.name == 'nt': judgeenv.load_env(cli=True) if not judgeenv.no_ansi_emu: try: from colorama import init init() except ImportError: pass judgeenv.env['runtime'] = {} for name in get_available(): executor = load_executor(name) if executor is None or not hasattr(executor, 'Executor'): continue if hasattr(executor.Executor, 'autoconfig'): print ansi_style( '%-43s%s' % ('Auto-configuring #ansi[%s](|underline):' % name, '')), try: data = executor.Executor.autoconfig() config = data[0] success = data[1] feedback = data[2] errors = '' if len(data) < 4 else data[3] except Exception: print ansi_style('#ansi[Not supported](red|bold)') traceback.print_exc() else: print ansi_style( ['#ansi[%s](red|bold)', '#ansi[%s](green|bold)'][success] % (feedback or ['Failed', 'Success'][success])) if not success: if config: print ' Attempted:' print ' ', yaml.dump( config, default_flow_style=False).rstrip().replace( '\n', '\n' + ' ' * 4) if errors: print ' Errors:' print ' ', errors.replace('\n', '\n' + ' ' * 4) if success: result.update(config) print print ansi_style('#ansi[Configuration result](green|bold|underline):') print yaml.dump({'runtime': result}, default_flow_style=False).rstrip()
def main(): result = {} if os.name == 'nt': judgeenv.load_env(cli=True) if not judgeenv.no_ansi_emu: try: from colorama import init init() except ImportError: pass judgeenv.env['runtime'] = {} for name in get_available(): executor = load_executor(name) if executor is None or not hasattr(executor, 'Executor'): continue if hasattr(executor.Executor, 'autoconfig'): print ansi_style('%-43s%s' % ('Auto-configuring #ansi[%s](|underline):' % name, '')), try: data = executor.Executor.autoconfig() config = data[0] success = data[1] feedback = data[2] errors = '' if len(data) < 4 else data[3] except Exception: print ansi_style('#ansi[Not supported](red|bold)') traceback.print_exc() else: print ansi_style(['#ansi[%s](red|bold)', '#ansi[%s](green|bold)'][success] % (feedback or ['Failed', 'Success'][success])) if not success: if config: print ' Attempted:' print ' ', yaml.dump(config, default_flow_style=False).rstrip().replace('\n', '\n' + ' ' * 4) if errors: print ' Errors:' print ' ', errors.replace('\n', '\n' + ' ' * 4) if success: result.update(config) print print ansi_style('#ansi[Configuration result](green|bold|underline):') print yaml.dump({'runtime': result}, default_flow_style=False).rstrip()
def main(): parser = argparse.ArgumentParser( description='Automatically configures runtimes') parser.add_argument('-s', '--silent', action='store_true', help='silent mode') silent = parser.parse_args().silent result = {} if os.name == 'nt': judgeenv.load_env(cli=True) if not judgeenv.no_ansi_emu: try: from colorama import init init() except ImportError: pass judgeenv.env['runtime'] = {} if silent: sys.stderr = open(os.devnull, 'w') for name in get_available(): executor = load_executor(name) if executor is None or not hasattr(executor, 'Executor'): continue Executor = executor.Executor if silent and not issubclass(Executor, NullStdoutMixin): # if you are printing errors into stdout, you may do so in your own blood # *cough* Racket *cough* Executor = type('Executor', (NullStdoutMixin, Executor), {}) if hasattr(Executor, 'autoconfig'): if not silent: print ansi_style( '%-43s%s' % ('Auto-configuring #ansi[%s](|underline):' % name, '')), try: data = Executor.autoconfig() config = data[0] success = data[1] feedback = data[2] errors = '' if len(data) < 4 else data[3] except Exception: if not silent: print ansi_style('#ansi[Not supported](red|bold)') traceback.print_exc() else: if not silent: print ansi_style( ['#ansi[%s](red|bold)', '#ansi[%s](green|bold)' ][success] % (feedback or ['Failed', 'Success'][success])) if not success: if not silent: if config: print ' Attempted:' print ' ', yaml.dump( config, default_flow_style=False).rstrip().replace( '\n', '\n' + ' ' * 4) if errors: print ' Errors:' print ' ', errors.replace('\n', '\n' + ' ' * 4) if success: result.update(config) if not silent: print print ansi_style('#ansi[Configuration result](green|bold|underline):') print yaml.dump({'runtime': result}, default_flow_style=False).rstrip()
import logging import platform from dmoj import judgeenv from dmoj.citest import ci_test from dmoj.executors import get_available arch = platform.machine() if arch == 'x86_64': ALLOW_FAIL = {'GASARM', 'JAVA9', 'JAVA10', 'OBJC', 'GROOVY'} EXECUTORS = get_available() elif arch == 'aarch64': EXECUTORS = { 'AWK', 'BF', 'C', 'C11', 'CPP03', 'CPP11', 'CPP14', 'CPP17', 'JAVA8', 'PAS', 'PERL', 'PY2', 'PY3', 'SED', 'TEXT', } ALLOW_FAIL = set() else:
def main(): parser = argparse.ArgumentParser( description='Automatically configures runtimes') output_conf = parser.add_mutually_exclusive_group() output_conf.add_argument('-s', '--silent', action='store_true', help='silent mode') output_conf.add_argument('-V', '--verbose', action='store_true', help='verbose mode') args = parser.parse_args() if not args.silent: logging.basicConfig( level=logging.DEBUG if args.verbose else logging.WARNING, format='%(message)s') result = {} judgeenv.env['runtime'] = {} if args.silent: sys.stderr = open(os.devnull, 'w') for name in get_available(): executor = load_executor(name) if executor is None or not hasattr(executor, 'Executor'): continue Executor = executor.Executor if not args.verbose and not issubclass(Executor, NullStdoutMixin): # if you are printing errors into stdout, you may do so in your own blood # *cough* Racket *cough* Executor = type('Executor', (NullStdoutMixin, Executor), {}) if hasattr(Executor, 'autoconfig'): if not args.silent: print_ansi( '%-43s%s' % ('Auto-configuring #ansi[%s](|underline):' % name, ''), end=' ', file=sys.stderr) sys.stdout.flush() try: data = Executor.autoconfig() config = data[0] success = data[1] feedback = data[2] errors = '' if len(data) < 4 else data[3] except Exception: if not args.silent: print_ansi('#ansi[Not supported](red|bold)', file=sys.stderr) traceback.print_exc() else: if not args.silent: print_ansi( ['#ansi[%s](red|bold)', '#ansi[%s](green|bold)' ][success] % (feedback or ['Failed', 'Success'][success]), file=sys.stderr, ) if not success and args.verbose: if config: print(' Attempted:', file=sys.stderr) print( ' ', yaml.safe_dump( config, default_flow_style=False).rstrip().replace( '\n', '\n' + ' ' * 4), file=sys.stderr, ) if errors: print(' Errors:', file=sys.stderr) print(' ', errors.replace('\n', '\n' + ' ' * 4), file=sys.stderr) if success: result.update(config) if not args.silent and sys.stdout.isatty(): print(file=sys.stderr) if result: if not args.silent and sys.stdout.isatty(): print_ansi('#ansi[Configuration result](green|bold|underline):', file=sys.stderr) else: print_ansi('#ansi[No runtimes configured.](red|bold)', file=sys.__stderr__) if not args.verbose: print_ansi( 'Run #ansi[%s -V](|underline) to see why this is the case.' % (parser.prog, ), file=sys.__stderr__) print( yaml.safe_dump({ 'runtime': result }, default_flow_style=False).rstrip())