1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

target: Add parts field to KernelVersion

This commit is contained in:
Brendan Jackman 2017-02-20 17:52:56 +00:00
parent 54adf80eab
commit 18b77b8808

View File

@ -1211,6 +1211,10 @@ class KernelVersion(object):
:type rc: int :type rc: int
:ivar sha1: Kernel git revision hash, if available (otherwise None) :ivar sha1: Kernel git revision hash, if available (otherwise None)
:type sha1: str :type sha1: str
:ivar parts: Tuple of version number components. Can be used for
lexicographically comparing kernel versions.
:type parts: tuple(int)
""" """
def __init__(self, version_string): def __init__(self, version_string):
if ' #' in version_string: if ' #' in version_string:
@ -1241,6 +1245,8 @@ class KernelVersion(object):
if groups['sha1'] is not None: if groups['sha1'] is not None:
self.sha1 = match.group('sha1') self.sha1 = match.group('sha1')
self.parts = (self.version_number, self.major, self.minor)
def __str__(self): def __str__(self):
return '{} {}'.format(self.release, self.version) return '{} {}'.format(self.release, self.version)