webfront.py

changeset 151
e4401bf4a387
parent 145
fde18c4d6784
equal deleted inserted replaced
150:fcc07f6907a8 151:e4401bf4a387
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 import argparse, sys
2 from flask import Flask, render_template, redirect, request 3 from flask import Flask, render_template, redirect, request
3 from ldcheck import appname, version, version_string 4 from ldcheck import appname, version, version_string
5 from ldcheck import load_rcfile, postprocess_library_paths
4 from parse import read_ldraw 6 from parse import read_ldraw
5 from testsuite import load_tests, check_model, problem_text, all_problem_types 7 from testsuite import load_tests, check_model, problem_text, all_problem_types
8
9 parser = argparse.ArgumentParser()
10 parser.add_argument('-l', '--library', action = 'append')
11 parser.add_argument('--color', action = 'store_true')
12 args = parser.parse_args(load_rcfile() + sys.argv[1:])
13 libraries = postprocess_library_paths(args.library)
6 14
7 app = Flask(appname) 15 app = Flask(appname)
8 16
9 from ldcheck import LDrawContext 17 from ldcheck import LDrawContext
10 try: 18 try:
11 context = LDrawContext() 19 context = LDrawContext(libraries = libraries)
12 except RuntimeError as error: 20 except RuntimeError as error:
13 from sys import stderr, exit 21 from sys import stderr, exit
14 print('error:', str(error), file = stderr) 22 print('error:', str(error), file = stderr)
15 exit(1) 23 exit(1)
16 24

mercurial