99from sphinx .locale import _
1010from sphinx .util import i18n as sphinx_i18n
1111
12- from exasol .toolbox .version import VERSION
12+ from exasol .toolbox .release import Version as ExasolVersion
13+ from exasol .toolbox .version import VERSION as PLUGIN_VERSION
1314
1415logger = logging .getLogger (__name__ )
1516
1617DATE_FMT = "%Y-%m-%d %H:%M:%S %z"
1718DEFAULT_TAG_WHITELIST = r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$"
18- DEFAULT_BRANCH_WHITELIST = r"( master|main) "
19+ DEFAULT_BRANCH_WHITELIST = r"master|main"
1920DEFAULT_REMOTE_WHITELIST = None
2021DEFAULT_RELEASED_PATTERN = r"^tags/.*$"
2122DEFAULT_OUTPUTDIR_FORMAT = r"{ref.name}"
4243)
4344
4445
45- class TagFormatError (Exception ):
46- """
47- Exception raised for errors in the tag format.
48-
49- The exception is raised when a tag is found to be incorrectly formatted.
50- """
51-
52-
53- class ExasolVersionTag :
54-
55- def __init__ (self , version ):
56- try :
57- v = version .name .strip ()
58- parts = v .split ("." )
59- major , minor , patch = map (int , parts )
60- except Exception as ex :
61- msg = f"Invalid tag format: '{ version } ', details: { ex } "
62- raise TagFormatError (msg ) from ex
63-
64- self ._version = version
65- self ._version_tripple = (major , minor , patch )
66-
67- @property
68- def version (self ):
69- return self ._version
70-
71- @property
72- def version_triple (self ):
73- return self ._version_tripple
74-
75-
7646class VersionInfo :
7747 def __init__ (self , app , context , metadata , current_version_name ):
7848 self .app = app
@@ -129,7 +99,7 @@ def in_development(self):
12999 def __iter__ (self ):
130100 yield from self .branches
131101 yield from sorted (
132- self .tags , key = lambda t : ExasolVersionTag ( t ). version_triple , reverse = True
102+ self .tags , key = lambda t : ExasolVersion . from_string ( t . name ) , reverse = True
133103 )
134104
135105 def __getitem__ (self , name ):
@@ -268,7 +238,7 @@ def setup(app):
268238 app .add_config_value ("smv_metadata" , {}, "html" )
269239 app .add_config_value ("smv_metadata_path" , "" , "html" )
270240 app .add_config_value ("smv_current_version" , "" , "html" )
271- app .add_config_value ("smv_latest_version" , "master " , "html" )
241+ app .add_config_value ("smv_latest_version" , "main " , "html" )
272242 app .add_config_value ("smv_tag_whitelist" , DEFAULT_TAG_WHITELIST , "html" )
273243 app .add_config_value ("smv_branch_whitelist" , DEFAULT_BRANCH_WHITELIST , "html" )
274244 app .add_config_value ("smv_remote_whitelist" , DEFAULT_REMOTE_WHITELIST , "html" )
@@ -283,7 +253,7 @@ def setup(app):
283253 app .connect ("config-inited" , config_inited )
284254
285255 return {
286- "version" : VERSION ,
256+ "version" : PLUGIN_VERSION ,
287257 "parallel_read_safe" : True ,
288258 "parallel_write_safe" : True ,
289259 }
0 commit comments