version_utils
appimage_updater.utils.version_utils
¶
Version handling utilities for the AppImage Updater.
This module provides centralized version normalization, formatting, and comparison utilities to ensure consistent version handling across the application.
create_nightly_version(asset)
¶
Create version string for nightly builds using asset creation date.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
asset
|
Asset
|
Asset with creation date information |
required |
Returns:
Type | Description |
---|---|
str
|
Date-based version string for nightly builds |
Source code in src/appimage_updater/utils/version_utils.py
extract_version_from_filename(filename, app_name)
¶
Extract version from filename as fallback.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
Filename to extract version from |
required |
app_name
|
str
|
Application name to remove from filename |
required |
Returns:
Type | Description |
---|---|
str | None
|
Extracted version string or None if not found |
Source code in src/appimage_updater/utils/version_utils.py
format_version_display(version)
¶
Format version for display, showing dates in a user-friendly format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version
|
str | None
|
Version string to format for display |
required |
Returns:
Type | Description |
---|---|
str
|
Formatted version string suitable for UI display |
Examples:
>>> format_version_display("20250918")
"2025-09-18"
>>> format_version_display("2025-09-18")
"2025-09-18"
>>> format_version_display("2.3.1-beta")
"2.3.1-beta"
Source code in src/appimage_updater/utils/version_utils.py
normalize_version_string(version)
¶
Normalize version string to the current scheme.
This is the authoritative version normalization function used throughout the application. It handles various version formats and ensures consistency.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version
|
str
|
Raw version string from various sources |
required |
Returns:
Type | Description |
---|---|
str
|
Normalized version string with consistent format |
Examples:
>>> normalize_version_string("v2.3.1-beta")
"2.3.1-beta"
>>> normalize_version_string("2.11.3-x86")
"2.11.3"
>>> normalize_version_string("OrcaSlicer 2.3.1 beta Release")
"2.3.1-beta"