big upgrades to upgrade system
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
@@ -5,6 +6,7 @@ import sys
|
||||
|
||||
import flask
|
||||
from flask_cors import CORS
|
||||
import lxml.etree as xmltree
|
||||
|
||||
log = logging.getLogger()
|
||||
pipe_stderr = logging.StreamHandler(sys.stderr)
|
||||
@@ -30,6 +32,7 @@ CORS(app)
|
||||
orig_url_for = app.url_for
|
||||
|
||||
xml_namespaces = {
|
||||
"rule": "seagull:rules",
|
||||
"items": "seagull:rules/items",
|
||||
"upgrades": "seagull:rules/upgrades"
|
||||
}
|
||||
@@ -58,6 +61,25 @@ def url_for_override(endpoint, *posargs, _anchor=None, _method=None, _scheme=Non
|
||||
|
||||
app.url_for = url_for_override
|
||||
|
||||
schemas = []
|
||||
pth_common_rule_schema = path_appdir / "basepak/rules/schemas/rules.xsd"
|
||||
doc_common_rule_schema = xmltree.parse(pth_common_rule_schema.as_posix())
|
||||
common_rule_schema = xmltree.XMLSchema(doc_common_rule_schema)
|
||||
|
||||
## \brief Validates all XML files in gamedata.
|
||||
# \internal
|
||||
#
|
||||
# This is typically run on program startup.
|
||||
def validate_xml_files():
|
||||
for schema in schemas:
|
||||
for file in gamedata.vfs.vfs.glob(schema[1]):
|
||||
pth_xml = file.path[1:]
|
||||
fd_xml = gamedata.vfs.open(pth_xml)
|
||||
doc = xmltree.parse(fd_xml)
|
||||
|
||||
if not schema[0].validate(doc):
|
||||
log.error(f"Bogus XML document: {pth_xml}")
|
||||
|
||||
## \internal
|
||||
# \brief Base Flask rendering context. Generated with render_base_context().
|
||||
base_context = {}
|
||||
@@ -86,7 +108,7 @@ def render_base_context():
|
||||
domain_components = flask.request.host.split(".")
|
||||
base_domain = ".".join(domain_components[-2:])
|
||||
|
||||
gamedata.vfs.copy_out("static/js/mermaid.esm.min.mjs", dest=path_appdir.as_posix())
|
||||
gamedata.vfs.copy_dir("static", dest=path_appdir.as_posix())
|
||||
|
||||
# all this wind up for...
|
||||
if base_domain == "otl-hga.net": # production, use assets from S3
|
||||
|
Reference in New Issue
Block a user