diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-08 13:22:59 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-08 13:41:08 +0300 |
commit | 0cd2ca6a9a4d9cb9206297350e21934ed99d6280 (patch) | |
tree | e8caa5b6939a6b83c70913640dfc898577482c30 /project/toolset.py | |
parent | v2.4 (diff) | |
download | cmake-common-0cd2ca6a9a4d9cb9206297350e21934ed99d6280.tar.gz cmake-common-0cd2ca6a9a4d9cb9206297350e21934ed99d6280.zip |
remove the "-" between toolset and version
Diffstat (limited to 'project/toolset.py')
-rw-r--r-- | project/toolset.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/project/toolset.py b/project/toolset.py index 5c5c414..0f94949 100644 --- a/project/toolset.py +++ b/project/toolset.py @@ -206,8 +206,6 @@ class ToolsetType(Enum): class ToolsetVersion: - _VERSION_SEP = '-' - def __init__(self, hint, version): self.hint = hint self.version = version @@ -215,7 +213,7 @@ class ToolsetVersion: def __str__(self): if self.version is None: return str(self.hint) - return f'{self.hint}{ToolsetVersion._VERSION_SEP}{self.version}' + return f'{self.hint}{self.version}' @staticmethod def default(): @@ -247,13 +245,13 @@ class ToolsetVersion: @staticmethod def help_versioned_toolsets(): - s = '''Some toolsets support specifying a version using the [-VERSION] suffix. This -is a list of all supported toolset versions: + s = '''Some toolsets support specifying a version using the VERSION suffix. This is +a list of all supported toolset versions: ''' for hint in ToolsetType.all_versioned(): for version in hint.all_versions(): - s += f' * {hint}{ToolsetVersion._VERSION_SEP}{version}\n' + s += f' * {hint}{version}\n' return s @staticmethod @@ -262,8 +260,8 @@ is a list of all supported toolset versions: return ToolsetVersion(ToolsetType(s), None) except ValueError: pass - for hint in ToolsetType.all_versioned(): - prefix = f'{hint}{ToolsetVersion._VERSION_SEP}' + for hint in sorted(ToolsetType.all_versioned(), key=str, reverse=True): + prefix = f'{hint}' if s.startswith(prefix): return ToolsetVersion(hint, hint.parse_version(s[len(prefix):])) raise argparse.ArgumentTypeError(f'invalid toolset: {s}') |