作为“猴子补丁”/解决方法,在 中bumpversion.version_part
,我_choose_serialize_format()
从
def _choose_serialize_format(self, version, context):
chosen = None
logger.debug(
"Available serialization formats: '%s'", "', '".join(self.serialize_formats)
)
for serialize_format in self.serialize_formats:
try:
self._serialize(
version, serialize_format, context, raise_if_incomplete=True
)
chosen = serialize_format
logger.debug("Found '%s' to be a usable serialization format", chosen)
except IncompleteVersionRepresentationException as e:
if not chosen:
chosen = serialize_format
except MissingValueForSerializationException as e:
logger.info(e.message)
raise e
if not chosen:
raise KeyError("Did not find suitable serialization format")
logger.debug("Selected serialization format '%s'", chosen)
return chosen
到
def _choose_serialize_format(self, version, context):
chosen = None
logger.debug(
"Available serialization formats: '%s'", "', '".join(self.serialize_formats)
)
if version._values["major"].value == "0":
_serialize_formats = [
self.serialize_formats[-1],
]
else:
_serialize_formats = self.serialize_formats
for serialize_format in _serialize_formats:
try:
self._serialize(
version, serialize_format, context, raise_if_incomplete=True
)
chosen = serialize_format
logger.debug("Found '%s' to be a usable serialization format", chosen)
except IncompleteVersionRepresentationException as e:
if not chosen:
chosen = serialize_format
except MissingValueForSerializationException as e:
logger.info(e.message)
raise e
if not chosen:
raise KeyError("Did not find suitable serialization format")
logger.debug("Selected serialization format '%s'", chosen)
return chosen
添加的行是
if version._values["major"].value == "0":
_serialize_formats = [
self.serialize_formats[-1],
]
else:
_serialize_formats = self.serialize_formats
并且更改的行是
for serialize_format in self.serialize_formats:
到
for serialize_format in _serialize_formats: