def check_config_file_version(filename): """Check to see if the version of the file name passed matches the config version MPF needs. Args: filename: The file with path to check. Raises: exception if the version of the file doesn't match what MPF needs. """ filename = FileManager.locate_file(filename) file_interface = FileManager.get_file_interface(filename) file_version = file_interface.get_config_file_version(filename) if file_version != int(__config_version__): log.error("Config file %s is version %s. MPF %s requires " "version %s", filename, file_version, __version__, __config_version__) log.error("Use the Config File Migrator to automatically " "migrate your config file to the latest version.") log.error("Migration tool: https://missionpinball.com/docs/tools/config-file-migrator/") log.error("More info on config version %s: " "https://missionpinball.com/docs/configuration-file" "-reference/important-config-file-concepts/config_version/config-version-%s/", __config_version__, __config_version__) return False else: return True
def check_config_file_version(filename: str) -> bool: """Check to see if the version of the file name passed matches the config version MPF needs. Args: filename: The file with path to check. Raises: exception if the version of the file doesn't match what MPF needs. """ filename = FileManager.locate_file(filename) file_interface = FileManager.get_file_interface(filename) file_version = file_interface.get_config_file_version(filename) if file_version != int(__config_version__): log.error( "Config file %s is version %s. MPF %s requires " "version %s", filename, file_version, __version__, __config_version__) # TODO remove this line when migrator is done log.error( "We have not created the config file migration tool yet" " for v5. In the meantime, see https://github.com/missionpinball/mpf/issues/897" " for a list of changes between config versions 4 and 5.") # TODO uncomment these and update links when migrator is done # log.error("Use the Config File Migrator to automatically " # "migrate your config file to the latest version.") # log.error("Migration tool: https://missionpinball.com/docs/tools/config-file-migrator/") # log.error("More info on config version %s: " # "http://docs.missionpinball.org/docs/configuration-file" # "-reference/important-config-file-concepts/config_version/config-version-%s/", # __config_version__, __config_version__) return False else: return True