Module ammcore.pkg.version¶
Version specifications.
Index¶
Function
Parse a version string. |
|
Parse a specification string. |
Class
Represents a package version. |
|
Represents a version specification, i.e. a parsed requirement version. |
Function¶
-
ammcore.pkg.version.parse(verTxt:
string, allowStar?:boolean) version:ammcore.pkg.version.Version¶ Parse a version string.
- Parameters:
verTxt (
string) – text representation of a version.allowStar? (
boolean) – allow last component of a version to be a wild card.
- Returns:
version (
ammcore.pkg.version.Version) – parsed version.
-
ammcore.pkg.version.parseSpec(specTxt:
string) spec:ammcore.pkg.version.VersionSpec¶ Parse a specification string.
Specification consists of components separated by comas. Each component has an operator and a version, for example
>=1.0.0, <2.0.0, !=1.5.*.Allowed operators include:
==, strict version equality. Version specifications used with this operator can have wildcard at the end, in which case the operator only compares prefixes;!=, strict version inequality.Version specifications used with this operator can have wildcard at the end, in which case the operator only compares prefixes;>, greater than the given version;>=, greater than or equal to the given version;<, lesser than the given version;<=, lesser than or equal to the given version;~, compatible with the given version. Using this operator allows the last component of the version to be greater than or equal to the specified one. That is,~1.0.5is equivalent to==1.0.*, >=1.0.5.
If operator is absent, it is implied to be
==.- Returns:
spec (
ammcore.pkg.version.VersionSpec) – parsed version spec.
Class¶
-
class ammcore.pkg.version.Version :
ammcore.class.Base¶ Represents a package version.
-
New(self: <T:
ammcore.pkg.version.Version>, ...:integer| "*") <T:ammcore.pkg.version.Version>¶ - Parameters:
... (
integer| "*") – components of the version. If given,"*"must be the last component.
-
up(self:
ammcore.pkg.version.Version) upVersion:ammcore.pkg.version.Version¶ Return version without its last component.
- Returns:
upVersion (
ammcore.pkg.version.Version) – version without its last component.
-
makeWild(self:
ammcore.pkg.version.Version) wildVersion:ammcore.pkg.version.Version¶ Return version with its last component replaced by wildcard.
- Returns:
wildVersion (
ammcore.pkg.version.Version) – version with its last component replaced by wildcard.
-
canonicalString(self:
ammcore.pkg.version.Version) canonicalString:string¶ Make a string that can be used to compare versions for strict equality, i.e. a version with trailing zeros remover.
-
staticmethod compat(lhs:
ammcore.pkg.version.Version, rhs:ammcore.pkg.version.Version)boolean¶ Check that versions are compatible (i.e.
x~1.0.5meansx>=1.0.5 and x==1.0.*).
-
New(self: <T:
-
class ammcore.pkg.version.VersionSpec :
ammcore.class.Base¶ Represents a version specification, i.e. a parsed requirement version.
-
New(self: <T:
ammcore.pkg.version.VersionSpec>, version?:ammcore.pkg.version.Version) <T:ammcore.pkg.version.VersionSpec>¶ - Parameters:
version? (
ammcore.pkg.version.Version) – if given, produces a version spec with an exact version pinned.
-
matches(self:
ammcore.pkg.version.VersionSpec, ver:ammcore.pkg.version.Version) match:boolean¶ Return
trueif this spec matches the given version.- Parameters:
ver (
ammcore.pkg.version.Version) – version to check.- Returns:
match (
boolean) –trueif version spec allows this version.
-
isExact(self:
ammcore.pkg.version.VersionSpec) isExact:boolean¶ Return
trueif this spec pins an exact version of a package.- Returns:
isExact (
boolean) – true` if this spec allows exactly one version of a package.
-
New(self: <T: