diff --git a/vasl_templates/webapp/data/vasl-version-aliases.json b/vasl_templates/webapp/data/vasl-version-aliases.json new file mode 100644 index 0000000..007704f --- /dev/null +++ b/vasl_templates/webapp/data/vasl-version-aliases.json @@ -0,0 +1,5 @@ +{ + +"6.6.3.1": "6.6.3" + +} diff --git a/vasl_templates/webapp/main.py b/vasl_templates/webapp/main.py index 74b9aff..431e43a 100644 --- a/vasl_templates/webapp/main.py +++ b/vasl_templates/webapp/main.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 ) diff --git a/vasl_templates/webapp/templates/program-info-content.html b/vasl_templates/webapp/templates/program-info-content.html index 76bcd92..cfaf740 100644 --- a/vasl_templates/webapp/templates/program-info-content.html +++ b/vasl_templates/webapp/templates/program-info-content.html @@ -23,7 +23,7 @@ {%if VASSAL_VERSION%} {{VASSAL_VERSION}} {%else%} n/a {%endif%} {%if VASSAL_DIR%} {{VASSAL_DIR}} {%endif%} VASL: - {%if VASL_VERSION%} {{VASL_VERSION}} {%else%} n/a {%endif%} + {%if VASL_REAL_VERSION%} {{VASL_REAL_VERSION}} {%else%} n/a {%endif%} {%if VASL_MOD%} {{VASL_MOD}} {%endif%} VASL extensions: {%if VASL_EXTNS_DIR%} {{VASL_EXTNS_DIR}} {%else%} - {%endif%} diff --git a/vasl_templates/webapp/vasl_mod.py b/vasl_templates/webapp/vasl_mod.py index b44ab71..3e21c47 100644 --- a/vasl_templates/webapp/vasl_mod.py +++ b/vasl_templates/webapp/vasl_mod.py @@ -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 {}.

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" )