version_parser
appimage_updater.core.version_parser
¶
Unified version parsing for filenames, URLs, and version strings.
This module provides centralized version extraction and normalization functionality that can be used across the entire application for consistent version handling.
VersionParser
¶
Unified version parsing for filenames, URLs, and version strings.
clean_filename_for_version_extraction(filename)
¶
Clean filename by removing git hashes and other variable identifiers.
This prevents interference with version extraction.
Source code in src/appimage_updater/core/version_parser.py
extract_version_from_filename(filename)
¶
Extract version from filename using common patterns.
Source code in src/appimage_updater/core/version_parser.py
generate_flexible_pattern_from_filename(filename, app_name=None)
¶
Generate a flexible regex pattern from a filename by eliminating variable identifiers.
The goal is to create a general pattern that matches the application name while being agnostic to architecture, distribution, version, and build type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
The asset filename to generate pattern from |
required |
app_name
|
str | None
|
Optional app name - if ends with release qualifiers (rc, alpha, beta, weekly, nightly), include them in the pattern |
None
|
Pattern suffix (.(|current|old))?$ matches rotation suffixes for downloaded files.
Source code in src/appimage_updater/core/version_parser.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |