Allow VASL versions to be aliased.

master
Pacman Ghost 2 years ago
parent 5c19af124a
commit 38399c355f
  1. 5
      vasl_templates/webapp/data/vasl-version-aliases.json
  2. 2
      vasl_templates/webapp/main.py
  3. 2
      vasl_templates/webapp/templates/program-info-content.html
  4. 15
      vasl_templates/webapp/vasl_mod.py

@ -130,6 +130,7 @@ def get_app_config():
logging.error( "Can't check the VASSAL version: %s", str(ex) )
if globvars.vasl_mod:
vals["VASL_VERSION"] = globvars.vasl_mod.vasl_version
vals["VASL_REAL_VERSION"] = globvars.vasl_mod.vasl_real_version
# include information about VASL extensions
if globvars.vasl_mod and globvars.vasl_mod.extns:
@ -179,6 +180,7 @@ def get_program_info():
}
if globvars.vasl_mod:
params[ "VASL_VERSION" ] = globvars.vasl_mod.vasl_version
params[ "VASL_REAL_VERSION" ] = globvars.vasl_mod.vasl_real_version
for key in [ "VASSAL_DIR", "VASL_MOD", "VASL_EXTNS_DIR", "BOARDS_DIR",
"JAVA_PATH", "WEBDRIVER_PATH", "CHAPTER_H_NOTES_DIR", "USER_FILES_DIR" ]:
params[ key ] = app.config.get( key )

@ -23,7 +23,7 @@
<td class="val"> {%if VASSAL_VERSION%} {{VASSAL_VERSION}} {%else%} <span class="na"> n/a </span> {%endif%}
{%if VASSAL_DIR%} <span class="extra path"> {{VASSAL_DIR}} </span> {%endif%}
<tr> <td class="key"> VASL:
<td class="val"> {%if VASL_VERSION%} {{VASL_VERSION}} {%else%} <span class="na"> n/a </span> {%endif%}
<td class="val"> {%if VASL_REAL_VERSION%} {{VASL_REAL_VERSION}} {%else%} <span class="na"> n/a </span> {%endif%}
{%if VASL_MOD%} <span class="extra path"> {{VASL_MOD}} </span> {%endif%}
<tr> <td class="key"> VASL extensions:
<td class="val path"> {%if VASL_EXTNS_DIR%} {{VASL_EXTNS_DIR}} {%else%} - {%endif%}

@ -48,7 +48,7 @@ def set_vasl_mod( vmod_fname, msg_store ):
if msg_store:
msg_store.warning(
"This program has not been tested with VASL {}.<p>Things might work, but they might not...".format(
globvars.vasl_mod.vasl_version
globvars.vasl_mod.vasl_real_version
)
)
@ -172,7 +172,7 @@ class VaslMod:
# load the VASL module and any extensions
self._load_vmod( data_dir )
if self.vasl_version not in SUPPORTED_VASL_MOD_VERSIONS:
_logger.warning( "Unsupported VASL version: %s", self.vasl_version )
_logger.warning( "Unsupported VASL version: %s", self.vasl_real_version )
def __del__( self ):
# clean up
@ -253,7 +253,16 @@ class VaslMod:
# get the VASL version
build_info = self._files[0][0].read( "buildFile" )
doc = xml.etree.ElementTree.fromstring( build_info )
self.vasl_version = doc.attrib.get( "version" )
# NOTE: We have data files for each version of VASL, mostly for tracking things like changed GPID's,
# expected image URL problems, etc. These don't always change between releases, so to avoid
# having to create a new set of identical data files, we allow VASL versions to be aliased.
# This also helps in the case of emergency releases e.g. 6.6.3.1 is treated the same as 6.6.3,
# and beta releases (e.g. 6.6.4-beta5 = 6.6.3).
self.vasl_real_version = doc.attrib.get( "version" )
fname = os.path.join( data_dir, "vasl-version-aliases.json" )
with open( fname, "r", encoding="utf-8" ) as fp:
aliases = json.load( fp )
self.vasl_version = aliases.get( self.vasl_real_version, self.vasl_real_version )
# load our overrides
fname = os.path.join( data_dir, "vasl-"+self.vasl_version, "vasl-overrides.json" )

Loading…
Cancel
Save