Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #189 from grrttedwards/release/1.9.2
Browse files Browse the repository at this point in the history
Release/1.9.2
  • Loading branch information
grrttedwards authored Aug 4, 2021
2 parents 3e09fda + 8e6be2c commit e48d3d3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
## Unreleased
-

## v1.9.1 - 06/06/2020
## v1.9.2 - 08/03/2021
- Fix bug where an entry in `installed.ini` could be zeroed out if there was an error updating the addon
- Remove broken test case where addon was removed from Tukui repository

## v1.9.1 - 06/06/2021
- Bump version of urllib3 for a security update
- Fix Curse site choosing wrong version when game version is Classic (Thanks @cr0ok)

## v1.9.0 - 05/19/2020
## v1.9.0 - 05/19/2021
- Add support for TBC Classic addons from Curse

## v1.8.1 - 04/09/2021
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.9.1
v1.9.2
1 change: 0 additions & 1 deletion test/site/test_tukui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
['https://www.tukui.org/classic-addons.php?id=2', 'https://www.tukui.org/classic-addons.php?download=2', 'ElvUI'],
['https://www.tukui.org/download.php?ui=tukui', 'https://www.tukui.org/downloads/tukui-', 'Tukui'],
['https://www.tukui.org/download.php?ui=elvui', 'https://www.tukui.org/downloads/elvui-', 'ElvUI'],
['https://www.tukui.org/addons.php?id=3', 'https://www.tukui.org/addons.php?download=3', 'AddOnSkins'],
['https://www.tukui.org/addons.php?id=186', 'https://www.tukui.org/addons.php?download=186', 'CopyPasta2']
]

Expand Down
14 changes: 9 additions & 5 deletions updater/manager/addon_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from io import BytesIO
from multiprocessing.pool import ThreadPool
from os.path import isfile, isdir, join
from typing import List
from typing import List, Optional

import requests
from requests import HTTPError
Expand Down Expand Up @@ -161,19 +161,23 @@ def extract_to_addons(self, zipped: zipfile.ZipFile, subfolder, site: AbstractSi
# no subfolder and no folder renaming needed, just copy the entire archive contents as-is
zipped.extractall(path=self.wow_addon_location)

def get_installed_version(self, addon_name):
def get_installed_version(self, addon_name: str) -> Optional[str]:
installed_vers = configparser.ConfigParser()
installed_vers.read(self.installed_vers_file)
try:
return installed_vers.get(addon_name, 'version')
except (configparser.NoSectionError, configparser.NoOptionError):
return None

def set_installed_versions(self):
def set_installed_versions(self) -> None:
versions = {}
for (addon_name, addon_url, _, new_version) in sorted(self.manifest):
if new_version != AddonManager._UNAVAILABLE:
versions[addon_name] = {"url": addon_url, "version": new_version}
# prevent an entry from zeroing out if the new version fails
# set the entry either to what it is now, or just skip if there was no old version
existing_version = self.get_installed_version(addon_name)
version = existing_version if new_version == AddonManager._UNAVAILABLE else new_version
if version is not None:
versions[addon_name] = {"url": addon_url, "version": version}

installed_versions = configparser.ConfigParser()
installed_versions.read_dict(versions)
Expand Down

0 comments on commit e48d3d3

Please sign in to comment.