mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-19 05:40:01 +10:00
products.py: Improve wording of latest products mechanism
This commit is contained in:
@@ -214,9 +214,9 @@ class CatalogProducts:
|
|||||||
|
|
||||||
# Remove all but the newest version
|
# Remove all but the newest version
|
||||||
for version in supported_versions:
|
for version in supported_versions:
|
||||||
_newest_version = packaging.version.parse("0.0.0")
|
_latest_stable_version = packaging.version.parse("0.0.0")
|
||||||
|
|
||||||
# First, determine largest version
|
# First, determine largest stable version
|
||||||
for installer in products:
|
for installer in products:
|
||||||
if installer["Version"] is None:
|
if installer["Version"] is None:
|
||||||
continue
|
continue
|
||||||
@@ -225,26 +225,28 @@ class CatalogProducts:
|
|||||||
if installer["Catalog"] in [SeedType.CustomerSeed, SeedType.DeveloperSeed, SeedType.PublicSeed]:
|
if installer["Catalog"] in [SeedType.CustomerSeed, SeedType.DeveloperSeed, SeedType.PublicSeed]:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
if packaging.version.parse(installer["Version"]) > _newest_version:
|
if packaging.version.parse(installer["Version"]) > _latest_stable_version:
|
||||||
_newest_version = packaging.version.parse(installer["Version"])
|
_latest_stable_version = packaging.version.parse(installer["Version"])
|
||||||
except packaging.version.InvalidVersion:
|
except packaging.version.InvalidVersion:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Next, remove all installers that are not the newest version
|
# Next, remove all installers that are older than the largest stable version
|
||||||
for installer in products:
|
for installer in products:
|
||||||
if installer["Version"] is None:
|
if installer["Version"] is None:
|
||||||
continue
|
continue
|
||||||
if not installer["Version"].startswith(version.value):
|
if not installer["Version"].startswith(version.value):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
if packaging.version.parse(installer["Version"]) < _newest_version:
|
if packaging.version.parse(installer["Version"]) < _latest_stable_version:
|
||||||
if installer in products_copy:
|
if installer in products_copy:
|
||||||
products_copy.pop(products_copy.index(installer))
|
products_copy.pop(products_copy.index(installer))
|
||||||
except packaging.version.InvalidVersion:
|
except packaging.version.InvalidVersion:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Remove beta versions if a public release is available
|
# If there is a largest stable version, remove all betas
|
||||||
if _newest_version != packaging.version.parse("0.0.0"):
|
# This is to ensure that we only keep the latest stable version where it is available
|
||||||
|
# but ensure we have a beta if it is the only version available (ie. macOS X.0 betas)
|
||||||
|
if _latest_stable_version != packaging.version.parse("0.0.0"):
|
||||||
if installer["Catalog"] in [SeedType.CustomerSeed, SeedType.DeveloperSeed, SeedType.PublicSeed]:
|
if installer["Catalog"] in [SeedType.CustomerSeed, SeedType.DeveloperSeed, SeedType.PublicSeed]:
|
||||||
if installer in products_copy:
|
if installer in products_copy:
|
||||||
products_copy.pop(products_copy.index(installer))
|
products_copy.pop(products_copy.index(installer))
|
||||||
|
|||||||
Reference in New Issue
Block a user