From 0809e8f4a4f0b2dbe9a354affe9561faa07c835e Mon Sep 17 00:00:00 2001 From: cary-rowen Date: Fri, 13 Sep 2024 02:33:34 +0800 Subject: [PATCH] Resubmit otau.py and otau_test.py from #267, point the update URL in app.py to the update_info.json of the main branch --- bookworm/app.py | 2 +- bookworm/otau.py | 6 +++++- tests/test_otau.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bookworm/app.py b/bookworm/app.py index baa79a6b..01a015bb 100644 --- a/bookworm/app.py +++ b/bookworm/app.py @@ -13,7 +13,7 @@ version_ex = "2022.1.0.30" url = "https://github.com/blindpandas/bookworm" website = "https://getbookworm.com" -update_url = "https://getbookworm.com/update_info.json" +update_url = "https://github.com/blindpandas/bookworm/blob/main/update_info.json" copyright = f"Copyright (c) 2022 {author} and {display_name} contributors." exit_code = 0 is_frozen = getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS") diff --git a/bookworm/otau.py b/bookworm/otau.py index 9acdc368..d89541e1 100644 --- a/bookworm/otau.py +++ b/bookworm/otau.py @@ -28,7 +28,9 @@ def __hash__(self): @field_validator("root") @classmethod def validate_identifier(cls, v: str): - if v not in ["", "b", "a", "dev"]: + if v is None: + v = "" + if v not in ["", "b", "a", "rc"]: raise TypeError("Unrecognized release identifier") return v @@ -61,6 +63,8 @@ def channels(self) -> Tuple[UpdateChannel]: return tuple(self.root.keys()) def get_update_info_for_channel(self, channel_identifier: str) -> VersionInfo: + if channel_identifier is None: + channel_identifier = "" return self.root.get(UpdateChannel.model_validate(channel_identifier)) diff --git a/tests/test_otau.py b/tests/test_otau.py index c3dd7614..63936676 100644 --- a/tests/test_otau.py +++ b/tests/test_otau.py @@ -9,7 +9,7 @@ def test_is_not_valid_identifier(): def test_is_valid_identifier(): - valid_identifiers = ('', 'a', 'b', 'dev') + valid_identifiers = ('', 'a', 'b', 'rc') for identifier in valid_identifiers: channel = UpdateChannel(identifier)