From 3f32291697372e145c49c2ea40f3b3d1c19d4dd8 Mon Sep 17 00:00:00 2001 From: heinezen Date: Sun, 28 Jul 2024 18:06:23 +0200 Subject: [PATCH] convert: Remove old changelog code. --- openage/convert/service/init/CMakeLists.txt | 1 - .../service/init/api_export_required.py | 2 +- openage/convert/service/init/changelog.py | 69 ------------------- openage/convert/tool/driver.py | 10 +-- openage/testing/testlist.py | 1 - 5 files changed, 6 insertions(+), 77 deletions(-) delete mode 100644 openage/convert/service/init/changelog.py diff --git a/openage/convert/service/init/CMakeLists.txt b/openage/convert/service/init/CMakeLists.txt index 3c7e404c69..aa588dcb29 100644 --- a/openage/convert/service/init/CMakeLists.txt +++ b/openage/convert/service/init/CMakeLists.txt @@ -1,7 +1,6 @@ add_py_modules( __init__.py api_export_required.py - changelog.py conversion_required.py modpack_search.py mount_asset_dirs.py diff --git a/openage/convert/service/init/api_export_required.py b/openage/convert/service/init/api_export_required.py index 90b78309d7..8bb3a51850 100644 --- a/openage/convert/service/init/api_export_required.py +++ b/openage/convert/service/init/api_export_required.py @@ -21,7 +21,7 @@ def api_export_required(asset_dir: UnionPath) -> bool: """ - Returns true if the openage nyan API modpack cannot be found. + Returns true if the openage nyan API modpack cannot be found or is outdated. TODO: Remove once the API modpack is generated by default. diff --git a/openage/convert/service/init/changelog.py b/openage/convert/service/init/changelog.py deleted file mode 100644 index 0c63aac864..0000000000 --- a/openage/convert/service/init/changelog.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2015-2022 the openage authors. See copying.md for legal info. - -""" -Asset version change log - -used to determine whether assets that were converted by an earlier version of -openage are still up to date. -""" -from __future__ import annotations -import typing -from ....log import warn -from ....testing.testing import TestError - -# filename where to store the versioning information -ASSET_VERSION_FILENAME = "asset_version" - -# filename where to store the gamespec version hash -GAMESPEC_VERSION_FILENAME = "gamespec_version" - -# available components for reconversion -COMPONENTS = { - "graphics", - "sounds", - "metadata", - "interface", -} - -# each line represents changes to the assets. -# the last line is the most recent change. -CHANGES = ( - {"graphics", "sounds"}, - {"sounds"}, - {"graphics"}, - {"interface"}, - {"interface"}, - {"metadata"}, - {"metadata"}, - {"graphics"}, -) - -# the current version number equals the number of changes -ASSET_VERSION = len(CHANGES) - 1 - - -def changes(asset_version: int) -> set: - """ - return all changed components since the passed version number. - """ - if asset_version >= len(CHANGES): - warn("asset version from the future: %d", asset_version) - warn("current version is: %d", ASSET_VERSION) - warn("leaving assets as they are.") - return set() - - changed_components = set() - - # TODO: Reimplement with proper detection based on file hashing - - return changed_components - - -def test() -> typing.NoReturn: - """ - verify only allowed versions are stored in the changes - """ - for entry in CHANGES: - if entry > COMPONENTS: - invalid = entry - COMPONENTS - raise TestError(f"'{invalid}': invalid changelog entry") diff --git a/openage/convert/tool/driver.py b/openage/convert/tool/driver.py index ba974f42e8..cdd1ed04a3 100644 --- a/openage/convert/tool/driver.py +++ b/openage/convert/tool/driver.py @@ -16,7 +16,6 @@ from ..service.debug_info import debug_gamedata_format from ..service.debug_info import debug_string_resources, \ debug_registered_graphics, debug_modpack, debug_execution_time -from ..service.init.changelog import (ASSET_VERSION) from ..service.read.gamedata import get_gamespec from ..service.read.palette import get_palettes from ..service.read.register_media import get_existing_graphics @@ -40,8 +39,6 @@ def convert(args: Namespace) -> None: # clean args (set by convert_metadata for convert_media) del args.palettes - info(f"asset conversion complete; asset version: {ASSET_VERSION}", ) - def convert_metadata(args: Namespace) -> None: """ @@ -105,8 +102,11 @@ def convert_metadata(args: Namespace) -> None: ModpackExporter.export(modpack, args) debug_modpack(args.debugdir, args.debug_info, modpack) - export_end = timeit.default_timer() - info("Finished modpack export (%.2f seconds)", export_end - export_start) + export_end = timeit.default_timer() + info("Finished export of modpack '%s' v%s (%.2f seconds)", + modpack.info.packagename, + modpack.info.version, + export_end - export_start) stages_time = { "read": read_end - read_start, diff --git a/openage/testing/testlist.py b/openage/testing/testlist.py index 37f323e8a8..8227537697 100644 --- a/openage/testing/testlist.py +++ b/openage/testing/testlist.py @@ -26,7 +26,6 @@ def tests_py(): yield "openage.assets.test" yield ("openage.cabextract.test.test", "test CAB archive extraction", lambda env: env["has_assets"]) - yield "openage.convert.service.init.changelog.test" yield "openage.cppinterface.exctranslate_tests.cpp_to_py" yield ("openage.cppinterface.exctranslate_tests.cpp_to_py_bounce", "translates the exception back and forth a few times")