class KernelVersion:
The version of the kernel.
A kernel version has at least a major and minor version numbers, and optionally a patch version number.
On Windows, the patch version is the build number.
Its string representation may contain additional information, such as the versioning suffix.
Note that a kernel version does not necessarily match with the "brand version" of the OS, e.g. Windows 7 has kernel version 6.1.
Method | __eq__ |
Compares the instance for equality with an object. |
Method | __init__ |
Returns an instance of this type from the major, minor, patch and version string. |
Method | __repr__ |
Returns the "official" string representation of this instance. |
Method | __str__ |
Returns the nicely printable string representation of this instance. |
Method | matches |
Compare the components of this instance with the non-None components of the other. |
Property | major |
The major version number. |
Property | minor |
The minor version number. |
Property | patch |
The patch version number, if any. |
Instance Variable | _major |
Undocumented |
Instance Variable | _minor |
Undocumented |
Instance Variable | _patch |
Undocumented |
Instance Variable | _version |
Undocumented |
Compares the instance for equality with an object.
- if the object is not a
KernelVersion
, will return False.
Parameters | |
other:object | Undocumented |
Returns | |
bool | Undocumented |
Returns an instance of this type from the major, minor, patch and version string.
The string can be arbitrary, but it is expected to be roughly the same format as semver.
Parameters | |
major:int | Undocumented |
minor:_Optional[ | Undocumented |
patch:_Optional[ | Undocumented |
version_Optional[ | Undocumented |
Returns the "official" string representation of this instance.
Returns | |
str | Undocumented |
Compare the components of this instance with the non-None components of the other.
This method behaves like the equality comparison, expects that it still considers this instance to match with the other if they only differ on components (minor, patch) that are None for the other.
This allows to compare for versions that are unconstrained on some dimensions, and this is used in Os.matches
and Os.expect
.
Notes
- The matches relationship is not symmetric: a.matches(b) does not imply b.matches(a)
- Equal instances always match.
- The string part of the kernel version is never compared in matches and does not influence the result of the match.
Parameters | |
other:KernelVersion | Undocumented |
Returns | |
bool | Undocumented |