Skip to content

Commit

Permalink
Add handling of the no-release or all-prelease case and some logging …
Browse files Browse the repository at this point in the history
…there

Signed-off-by: Jim Hawkins <sjjhsjjhsjjh@gmail.com>
  • Loading branch information
sjjhsjjh committed May 3, 2024
1 parent c67d76e commit 9235269
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/update_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,14 @@ def _process_release_information(self):
with self._releasesRawPath.open("rb") as file:
releases = json.load(file) # Will be an array of objects.

if releases is None:
if releases is None or len(releases) == 0:
logger.error(f"No information {releases=}")
return None

latestIndex = None
latestPublished = None
runningIndex = None
prereleases = 0
for index, release in enumerate(releases):
published, publishedStr = self._published(release)
running, prerelease, name = self._running(release)
Expand All @@ -284,6 +286,7 @@ def _process_release_information(self):


if prerelease:
prereleases += 1
continue

if latestIndex is not None:
Expand All @@ -296,15 +299,20 @@ def _process_release_information(self):
latestIndex = index
latestPublished = published



# ToDo add a CLI to override this.
if runningIndex is None:
logger.info(
"Running an unpublished developer version."
" No installer asset download.")
self._state.set(runningPublished=" in development.")
return None

if latestIndex is None:
logger.info(
f'{latestIndex=}.'
f' Total release count {len(releases)}.'
f' Of which, prerelease count {prereleases}.')
return None

if latestIndex == runningIndex:
# Running software is the latest published, so no need to download
Expand Down

0 comments on commit 9235269

Please sign in to comment.