From 0ee404d4d8e8ddc978d5a4a1fb8e04c7e478fc07 Mon Sep 17 00:00:00 2001 From: ngld Date: Tue, 16 Oct 2018 14:42:11 +0200 Subject: [PATCH 1/3] Fix ModNotFound exception during retail installation while ensuring retail installation is properly recorded. --- knossos/tasks.py | 27 ++++++++++++++++++++++----- knossos/web.py | 4 ++-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/knossos/tasks.py b/knossos/tasks.py index 57785503..a0ed2789 100644 --- a/knossos/tasks.py +++ b/knossos/tasks.py @@ -1561,6 +1561,7 @@ def __init__(self, gog_path, dest_path): self.abort() return + create_retail_mod(self._dest_path) self.mods = [center.installed.query('FS2')] self._slot_prog = { 'total': ('Status', 0, 'Waiting...') @@ -1744,15 +1745,20 @@ def finish(self): 'selected data path or contact ngld for more information.' QtWidgets.QMessageBox.critical(None, translate('tasks', 'Error'), msg) - return elif results[0] == -1: QtWidgets.QMessageBox.critical(None, translate('tasks', 'Error'), self.tr( 'The selected file wasn\'t a proper Inno Setup installer. Are you shure you selected the right file?')) - return else: - create_retail_mod(self._dest_path) center.main_win.update_mod_list() center.main_win.browser_ctrl.bridge.retailInstalled.emit() + return + + path = os.path.join(self._dest_path, 'mod.json') + if os.path.isfile(path): + os.unlink(path) + + if center.installed.has('FS2'): + center.installed.del_mod(center.installed.query('FS2')) class GOGCopyTask(progress.Task): @@ -1769,6 +1775,7 @@ def __init__(self, gog_path, dest_path): self._makedirs(dest_path) + create_retail_mod(self._dest_path) self.mods = [center.installed.query('FS2')] self._slot_prog = { 'total': ('Status', 0, 'Waiting...') @@ -1819,7 +1826,6 @@ def _makedirs(self, path): def finish(self): if self._reason == 'done': - create_retail_mod(self._dest_path) center.main_win.update_mod_list() center.main_win.browser_ctrl.bridge.retailInstalled.emit() return @@ -1828,6 +1834,13 @@ def finish(self): else: msg = 'Copying the retail files failed. Please make sure Knossos can write to the data path.' + path = os.path.join(self._dest_path, 'mod.json') + if os.path.isfile(path): + os.unlink(path) + + if center.installed.has('FS2'): + center.installed.del_mod(center.installed.query('FS2')) + QtWidgets.QMessageBox.critical(None, 'Error', msg) @@ -2116,7 +2129,11 @@ def work(self, mod): self._engine_cache[dep['id']] = is_engine if is_engine: - spec = util.Spec(dep['version']) + if dep['version']: + spec = util.Spec(dep['version']) + else: + spec = util.Spec('*') + engine_id = dep['id'] break diff --git a/knossos/web.py b/knossos/web.py index 99dc1285..db6fb242 100644 --- a/knossos/web.py +++ b/knossos/web.py @@ -51,11 +51,11 @@ def sendMessage(self, msg): if isinstance(v, QtCore.QJsonValue): msg[k] = v.toVariant() - print('#-> ', json.dumps(msg)) + # print('#-> ', json.dumps(msg)) self._conn.sendTextMessage(json.dumps(msg)) def socketMessageReceived(self, msg): - print('#<- ', json.loads(msg)) + # print('#<- ', json.loads(msg)) self.messageReceived.emit(json.loads(msg), self) def socketDisconnected(self): From 808353e43d0d2b1eee54a881e8dfca7a8731a357 Mon Sep 17 00:00:00 2001 From: ngld Date: Tue, 16 Oct 2018 14:42:34 +0200 Subject: [PATCH 2/3] Fix JS error caused by accessing a property on an undefined object. --- html/js/mod_button_methods.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/js/mod_button_methods.js b/html/js/mod_button_methods.js index 522e8bb5..b3302fc8 100644 --- a/html/js/mod_button_methods.js +++ b/html/js/mod_button_methods.js @@ -4,7 +4,7 @@ export default { }, update() { - fs2mod.updateMod(this.mod.id, this.mod.versions[0].installed ? this.mod.versions[0].version : ''); + fs2mod.updateMod(this.mod.id, ''); }, install() { From 6321576f27bae343d4f3cee6c43ec77404b37773 Mon Sep 17 00:00:00 2001 From: ngld Date: Tue, 16 Oct 2018 16:45:21 +0200 Subject: [PATCH 3/3] Fixed two small but annoying issues: * mod folder removal on Winos is now more robust * Ubuntu users won't have to see the "override_dh_link" issue again --- knossos/tasks.py | 2 +- releng/ubuntu/debian/rules | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/knossos/tasks.py b/knossos/tasks.py index a0ed2789..bfcf8824 100644 --- a/knossos/tasks.py +++ b/knossos/tasks.py @@ -892,7 +892,7 @@ def work(self, dummy): for i, name in enumerate(items): progress.update(i / count, 'Deleting files...') - os.unlink(name) + util.safe_unlink(name) # Delete the remaining empty directories and other stuff shutil.rmtree(path) diff --git a/releng/ubuntu/debian/rules b/releng/ubuntu/debian/rules index f9600585..c7a70504 100644 --- a/releng/ubuntu/debian/rules +++ b/releng/ubuntu/debian/rules @@ -8,7 +8,7 @@ export PYBUILD_INSTALL_DIR=/usr/share/knossos override_dh_link: dh_link echo '#!/bin/bash' > debian/knossos/usr/bin/knossos - echo 'exec python3 /usr/share/knossos/knossos/__main__.py "$@"' >> debian/knossos/usr/bin/knossos + echo 'exec python3 /usr/share/knossos/knossos/__main__.py "\$@"' >> debian/knossos/usr/bin/knossos %: dh $@ --with python3 --buildsystem=pybuild