Skip to content

Commit 441ae6a

Browse files
committed
support latestversion
1 parent 74142cb commit 441ae6a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

port/linux/release_helper.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ def __init__(self, pkg_dict: dict, name: str):
4747
self.versions.append(VersionInfo(version_dicription))
4848
except:
4949
continue
50+
51+
def latestVersion(self):
52+
# find the latest version
53+
latest_version = self.versions[0]
54+
for version in self.versions:
55+
if version.vmajor > latest_version.vmajor:
56+
latest_version = version
57+
elif version.vmajor == latest_version.vmajor:
58+
if version.vminor > latest_version.vminor:
59+
latest_version = version
60+
elif version.vminor == latest_version.vminor:
61+
if version.vpatch > latest_version.vpatch:
62+
latest_version = version
63+
return latest_version
5064

5165

5266
class PackageReleaseList:
@@ -62,7 +76,7 @@ def __init__(self, file_path):
6276
for package in self.pkg_dict['packages']:
6377
self.packages.append(PackageRelease(
6478
self.pkg_dict['packages'], package['name']))
65-
79+
6680
def latestCommit(self, package_name: str):
6781
# find the package
6882
for package in self.packages:

0 commit comments

Comments
 (0)