mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-16 16:23:51 +01:00
update tests for new defaults
This commit is contained in:
parent
54ab1151f1
commit
145401de33
30 changed files with 495 additions and 417 deletions
|
|
@ -5,4 +5,4 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
"""PyCalVer: CalVer for Python Packages."""
|
||||
|
||||
__version__ = "v202010.1041-beta"
|
||||
__version__ = "v2020.1041-beta"
|
||||
|
|
@ -39,7 +39,7 @@ except ImportError:
|
|||
|
||||
click.disable_unicode_literals_warning = True
|
||||
|
||||
logger = logging.getLogger("pycalver.cli")
|
||||
logger = logging.getLogger("pycalver2.cli")
|
||||
|
||||
|
||||
_VERBOSE = 0
|
||||
|
|
@ -95,7 +95,7 @@ def _validate_release_tag(tag: typ.Optional[str]) -> None:
|
|||
if tag in VALID_RELEASE_TAG_VALUES:
|
||||
return
|
||||
|
||||
logger.error(f"Invalid argument --release={tag}")
|
||||
logger.error(f"Invalid argument --tag={tag}")
|
||||
logger.error(f"Valid arguments are: {', '.join(VALID_RELEASE_TAG_VALUES)}")
|
||||
sys.exit(1)
|
||||
|
||||
|
|
@ -126,24 +126,21 @@ def _validate_flags(
|
|||
|
||||
|
||||
def _log_no_change(subcmd: str, version_pattern: str, old_version: str) -> None:
|
||||
msg = (
|
||||
f"Version did not change: '{old_version}'. "
|
||||
f"Invalid version and/or pattern '{version_pattern}'."
|
||||
)
|
||||
msg = f"Invalid version '{old_version}' and/or pattern '{version_pattern}'."
|
||||
logger.error(msg)
|
||||
|
||||
is_semver = "{semver}" in version_pattern or (
|
||||
"MAJOR" in version_pattern and "MAJOR" in version_pattern and "PATCH" in version_pattern
|
||||
)
|
||||
if is_semver:
|
||||
logger.warning(f"pycalver {subcmd} [--major/--minor/--patch] required for use with SemVer.")
|
||||
logger.warning(f"calver {subcmd} [--major/--minor/--patch] required for use with SemVer.")
|
||||
else:
|
||||
available_flags = [
|
||||
"--" + part.lower() for part in ['MAJOR', 'MINOR', 'PATCH'] if part in version_pattern
|
||||
]
|
||||
if available_flags:
|
||||
available_flags_str = "/".join(available_flags)
|
||||
logger.info(f"Perhaps try: pycalver {subcmd} {available_flags_str} ")
|
||||
logger.info(f"Perhaps try: calver {subcmd} {available_flags_str} ")
|
||||
|
||||
|
||||
def _get_normalized_pattern(raw_pattern: str, version_pattern: typ.Optional[str]) -> str:
|
||||
|
|
@ -167,37 +164,36 @@ def _get_normalized_pattern(raw_pattern: str, version_pattern: typ.Optional[str]
|
|||
|
||||
|
||||
@click.group()
|
||||
@click.version_option(version="v202010.1041-beta")
|
||||
@click.version_option(version="v2020.1041-beta")
|
||||
@click.help_option()
|
||||
@click.option('-v', '--verbose', count=True, help="Control log level. -vv for debug level.")
|
||||
def cli(verbose: int = 0) -> None:
|
||||
"""Automatically update PyCalVer version strings in all project files."""
|
||||
"""Automatically update CalVer version strings in plaintext files."""
|
||||
if verbose:
|
||||
_configure_logging(verbose=max(_VERBOSE, verbose))
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("old_version")
|
||||
@click.argument("pattern", default="{pycalver}")
|
||||
@click.option('-v', '--verbose', count=True, help="Control log level. -vv for debug level.")
|
||||
@click.option(
|
||||
"--release",
|
||||
default=None,
|
||||
metavar="<NAME>",
|
||||
help=(
|
||||
f"Override release name of current_version. Valid options are: "
|
||||
f"{', '.join(VALID_RELEASE_TAG_VALUES)}."
|
||||
),
|
||||
)
|
||||
@click.argument("pattern", default="vYYYY.BUILD[-TAG]")
|
||||
@click.option('-v' , '--verbose', count=True, help="Control log level. -vv for debug level.")
|
||||
@click.option("--major", is_flag=True, default=False, help="Increment major component.")
|
||||
@click.option("-m" , "--minor", is_flag=True, default=False, help="Increment minor component.")
|
||||
@click.option("-p" , "--patch", is_flag=True, default=False, help="Increment patch component.")
|
||||
@click.option(
|
||||
"-r",
|
||||
"--release-num",
|
||||
"--tag",
|
||||
default=None,
|
||||
metavar="<NAME>",
|
||||
help=(
|
||||
f"Override release tag of current_version. Valid options are: "
|
||||
f"{', '.join(VALID_RELEASE_TAG_VALUES)}."
|
||||
),
|
||||
)
|
||||
@click.option(
|
||||
"--tag-num",
|
||||
is_flag=True,
|
||||
default=False,
|
||||
help="Increment release number (rc1, rc2, rc3..).",
|
||||
help="Increment release tag number (rc1, rc2, rc3..).",
|
||||
)
|
||||
@click.option("--pin-date", is_flag=True, default=False, help="Leave date components unchanged.")
|
||||
@click.option(
|
||||
|
|
@ -208,19 +204,18 @@ def cli(verbose: int = 0) -> None:
|
|||
)
|
||||
def test(
|
||||
old_version: str,
|
||||
pattern : str = "{pycalver}",
|
||||
pattern : str = "vYYYY.BUILD[-TAG]",
|
||||
verbose : int = 0,
|
||||
release : str = None,
|
||||
tag : str = None,
|
||||
major : bool = False,
|
||||
minor : bool = False,
|
||||
patch : bool = False,
|
||||
release_num: bool = False,
|
||||
tag_num : bool = False,
|
||||
pin_date : bool = False,
|
||||
date : typ.Optional[str] = None,
|
||||
) -> None:
|
||||
"""Increment a version number for demo purposes."""
|
||||
_configure_logging(verbose=max(_VERBOSE, verbose))
|
||||
tag = release # use internal naming convention
|
||||
_validate_release_tag(tag)
|
||||
|
||||
raw_pattern = pattern # use internal naming convention
|
||||
|
|
@ -231,11 +226,11 @@ def test(
|
|||
new_version = incr_dispatch(
|
||||
old_version,
|
||||
raw_pattern=raw_pattern,
|
||||
tag=tag,
|
||||
major=major,
|
||||
minor=minor,
|
||||
patch=patch,
|
||||
release_num=release_num,
|
||||
tag=tag,
|
||||
tag_num=tag_num,
|
||||
pin_date=pin_date,
|
||||
date=_date,
|
||||
)
|
||||
|
|
@ -370,7 +365,7 @@ def show(verbose: int = 0, fetch: bool = True) -> None:
|
|||
_, cfg = config.init(project_path=".")
|
||||
|
||||
if cfg is None:
|
||||
logger.error("Could not parse configuration. Perhaps try 'pycalver init'.")
|
||||
logger.error("Could not parse configuration. Perhaps try 'calver init'.")
|
||||
sys.exit(1)
|
||||
|
||||
cfg = _update_cfg_from_vcs(cfg, fetch)
|
||||
|
|
@ -432,13 +427,13 @@ def incr_dispatch(
|
|||
old_version: str,
|
||||
raw_pattern: str,
|
||||
*,
|
||||
tag : str = None,
|
||||
major : bool = False,
|
||||
minor : bool = False,
|
||||
patch : bool = False,
|
||||
release_num: bool = False,
|
||||
pin_date : bool = False,
|
||||
date : typ.Optional[dt.date] = None,
|
||||
major : bool = False,
|
||||
minor : bool = False,
|
||||
patch : bool = False,
|
||||
tag : str = None,
|
||||
tag_num : bool = False,
|
||||
pin_date: bool = False,
|
||||
date : typ.Optional[dt.date] = None,
|
||||
) -> typ.Optional[str]:
|
||||
v1_parts = list(v1patterns.PART_PATTERNS) + list(v1patterns.FULL_PART_FORMATS)
|
||||
has_v1_part = any("{" + part + "}" in raw_pattern for part in v1_parts)
|
||||
|
|
@ -456,11 +451,11 @@ def incr_dispatch(
|
|||
new_version = v1version.incr(
|
||||
old_version,
|
||||
raw_pattern=raw_pattern,
|
||||
tag=tag,
|
||||
major=major,
|
||||
minor=minor,
|
||||
patch=patch,
|
||||
release_num=release_num,
|
||||
tag=tag,
|
||||
tag_num=tag_num,
|
||||
pin_date=pin_date,
|
||||
date=date,
|
||||
)
|
||||
|
|
@ -468,11 +463,11 @@ def incr_dispatch(
|
|||
new_version = v2version.incr(
|
||||
old_version,
|
||||
raw_pattern=raw_pattern,
|
||||
tag=tag,
|
||||
major=major,
|
||||
minor=minor,
|
||||
patch=patch,
|
||||
release_num=release_num,
|
||||
tag=tag,
|
||||
tag_num=tag_num,
|
||||
pin_date=pin_date,
|
||||
date=date,
|
||||
)
|
||||
|
|
@ -481,7 +476,7 @@ def incr_dispatch(
|
|||
return None
|
||||
elif pkg_resources.parse_version(new_version) <= pkg_resources.parse_version(old_version):
|
||||
logger.error("Invariant violated: New version must be greater than old version ")
|
||||
logger.error(f" Result: '{new_version}' > '{old_version}' -> False")
|
||||
logger.error(f" Failed Invariant: '{new_version}' > '{old_version}'")
|
||||
return None
|
||||
else:
|
||||
return new_version
|
||||
|
|
@ -619,15 +614,6 @@ def _update_cfg_from_vcs(cfg: config.Config, fetch: bool) -> config.Config:
|
|||
is_flag=True,
|
||||
help="Display diff of changes, don't rewrite files.",
|
||||
)
|
||||
@click.option(
|
||||
"--release",
|
||||
default=None,
|
||||
metavar="<NAME>",
|
||||
help=(
|
||||
f"Override release name of current_version. Valid options are: "
|
||||
f"{', '.join(VALID_RELEASE_TAG_VALUES)}."
|
||||
),
|
||||
)
|
||||
@click.option(
|
||||
"--allow-dirty",
|
||||
default=False,
|
||||
|
|
@ -642,11 +628,20 @@ def _update_cfg_from_vcs(cfg: config.Config, fetch: bool) -> config.Config:
|
|||
@click.option("-m", "--minor", is_flag=True, default=False, help="Increment minor component.")
|
||||
@click.option("-p", "--patch", is_flag=True, default=False, help="Increment patch component.")
|
||||
@click.option(
|
||||
"-r",
|
||||
"--release-num",
|
||||
"-t",
|
||||
"--tag",
|
||||
default=None,
|
||||
metavar="<NAME>",
|
||||
help=(
|
||||
f"Override release tag of current_version. Valid options are: "
|
||||
f"{', '.join(VALID_RELEASE_TAG_VALUES)}."
|
||||
),
|
||||
)
|
||||
@click.option(
|
||||
"--tag-num",
|
||||
is_flag=True,
|
||||
default=False,
|
||||
help="Increment release number (rc1, rc2, rc3..).",
|
||||
help="Increment release tag number (rc1, rc2, rc3..).",
|
||||
)
|
||||
@click.option("--pin-date", is_flag=True, default=False, help="Leave date components unchanged.")
|
||||
@click.option(
|
||||
|
|
@ -656,7 +651,6 @@ def _update_cfg_from_vcs(cfg: config.Config, fetch: bool) -> config.Config:
|
|||
help=f"Set explicit date in format YYYY-0M-0D (e.g. {_current_date}).",
|
||||
)
|
||||
def bump(
|
||||
release : typ.Optional[str] = None,
|
||||
verbose : int = 0,
|
||||
dry : bool = False,
|
||||
allow_dirty: bool = False,
|
||||
|
|
@ -664,15 +658,14 @@ def bump(
|
|||
major : bool = False,
|
||||
minor : bool = False,
|
||||
patch : bool = False,
|
||||
release_num: bool = False,
|
||||
tag : typ.Optional[str] = None,
|
||||
tag_num : bool = False,
|
||||
pin_date : bool = False,
|
||||
date : typ.Optional[str] = None,
|
||||
) -> None:
|
||||
"""Increment the current version string and update project files."""
|
||||
verbose = max(_VERBOSE, verbose)
|
||||
_configure_logging(verbose)
|
||||
|
||||
tag = release # use internal naming convention
|
||||
_validate_release_tag(tag)
|
||||
_date = _validate_date(date, pin_date)
|
||||
|
||||
|
|
@ -688,11 +681,11 @@ def bump(
|
|||
new_version = incr_dispatch(
|
||||
old_version,
|
||||
raw_pattern=cfg.version_pattern,
|
||||
tag=tag,
|
||||
major=major,
|
||||
minor=minor,
|
||||
patch=patch,
|
||||
release_num=release_num,
|
||||
tag=tag,
|
||||
tag_num=tag_num,
|
||||
pin_date=pin_date,
|
||||
date=_date,
|
||||
)
|
||||
|
|
@ -22,7 +22,7 @@ from . import v1patterns
|
|||
from . import v2patterns
|
||||
from .patterns import Pattern
|
||||
|
||||
logger = logging.getLogger("pycalver.config")
|
||||
logger = logging.getLogger("pycalver2.config")
|
||||
|
||||
RawPatterns = typ.List[str]
|
||||
RawPatternsByFile = typ.Dict[str, RawPatterns]
|
||||
|
|
@ -428,7 +428,7 @@ def init(
|
|||
DEFAULT_CONFIGPARSER_BASE_TMPL = """
|
||||
[pycalver]
|
||||
current_version = "{initial_version}"
|
||||
version_pattern = "vYYYY0M.BUILD[-RELEASE]"
|
||||
version_pattern = "vYYYY.BUILD[-TAG]"
|
||||
commit_message = "bump version {{old_version}} -> {{new_version}}"
|
||||
commit = True
|
||||
tag = True
|
||||
|
|
@ -468,7 +468,7 @@ README.md =
|
|||
DEFAULT_TOML_BASE_TMPL = """
|
||||
[pycalver]
|
||||
current_version = "{initial_version}"
|
||||
version_pattern = "vYYYY0M.BUILD[-RELEASE]"
|
||||
version_pattern = "vYYYY.BUILD[-TAG]"
|
||||
commit_message = "bump version {{old_version}} -> {{new_version}}"
|
||||
commit = true
|
||||
tag = true
|
||||
|
|
@ -517,11 +517,11 @@ DEFAULT_TOML_README_MD_STR = """
|
|||
|
||||
|
||||
def _initial_version() -> str:
|
||||
return dt.datetime.now().strftime("v%Y%m.1001-alpha")
|
||||
return dt.datetime.utcnow().strftime("v%Y.1001-alpha")
|
||||
|
||||
|
||||
def _initial_version_pep440() -> str:
|
||||
return dt.datetime.now().strftime("%Y%m.1001a0")
|
||||
return dt.datetime.utcnow().strftime("%Y.1001a0")
|
||||
|
||||
|
||||
def default_config(ctx: ProjectContext) -> str:
|
||||
|
|
@ -9,7 +9,7 @@ import textwrap
|
|||
|
||||
from . import pysix
|
||||
|
||||
logger = logging.getLogger("pycalver.regexfmt")
|
||||
logger = logging.getLogger("pycalver2.regexfmt")
|
||||
|
||||
|
||||
def format_regex(regex: str) -> str:
|
||||
|
|
@ -38,7 +38,7 @@ from . import utils
|
|||
from .patterns import RE_PATTERN_ESCAPES
|
||||
from .patterns import Pattern
|
||||
|
||||
logger = logging.getLogger("pycalver.v1patterns")
|
||||
logger = logging.getLogger("pycalver2.v1patterns")
|
||||
|
||||
# https://regex101.com/r/fnj60p/10
|
||||
PYCALVER_PATTERN = r"""
|
||||
|
|
@ -207,18 +207,31 @@ def _compile_pattern_re(normalized_pattern: str) -> typ.Pattern[str]:
|
|||
return re.compile(pattern_str)
|
||||
|
||||
|
||||
def _normalized_pattern(version_pattern: str, raw_pattern: str) -> str:
|
||||
res = raw_pattern.replace(r"{version}", version_pattern)
|
||||
if version_pattern == r"{pycalver}":
|
||||
res = res.replace(r"{pep440_version}", r"{pep440_pycalver}")
|
||||
elif version_pattern == r"{semver}":
|
||||
res = res.replace(r"{pep440_version}", r"{semver}")
|
||||
elif version_pattern == r"v{year}{month}{build}{release}":
|
||||
res = res.replace(r"{pep440_version}", r"{year}{month}.{BID}{pep440_tag}")
|
||||
elif version_pattern == r"{year}{month}{build}{release}":
|
||||
res = res.replace(r"{pep440_version}", r"{year}{month}.{BID}{pep440_tag}")
|
||||
elif version_pattern == r"v{year}{build}{release}":
|
||||
res = res.replace(r"{pep440_version}", r"{year}.{BID}{pep440_tag}")
|
||||
elif version_pattern == r"{year}{build}{release}":
|
||||
res = res.replace(r"{pep440_version}", r"{year}.{BID}{pep440_tag}")
|
||||
elif r"{pep440_version}" in raw_pattern:
|
||||
logger.warning(f"No mapping of '{version_pattern}' to '{{pep440_version}}'")
|
||||
|
||||
return res
|
||||
|
||||
|
||||
@utils.memo
|
||||
def compile_pattern(version_pattern: str, raw_pattern: typ.Optional[str] = None) -> Pattern:
|
||||
_raw_pattern = version_pattern if raw_pattern is None else raw_pattern
|
||||
normalized_pattern = _raw_pattern.replace(r"{version}", version_pattern)
|
||||
if version_pattern == r"{pycalver}":
|
||||
normalized_pattern = normalized_pattern.replace(r"{pep440_version}", r"{pep440_pycalver}")
|
||||
elif version_pattern == r"{semver}":
|
||||
normalized_pattern = normalized_pattern.replace(r"{pep440_version}", r"{semver}")
|
||||
elif r"{pep440_version}" in _raw_pattern:
|
||||
logger.warning(f"No mapping of '{version_pattern}' to '{{pep440_version}}'")
|
||||
|
||||
regexp = _compile_pattern_re(normalized_pattern)
|
||||
normalized_pattern = _normalized_pattern(version_pattern, _raw_pattern)
|
||||
regexp = _compile_pattern_re(normalized_pattern)
|
||||
return Pattern(version_pattern, normalized_pattern, regexp)
|
||||
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ from . import regexfmt
|
|||
from . import v1version
|
||||
from .patterns import Pattern
|
||||
|
||||
logger = logging.getLogger("pycalver.v1rewrite")
|
||||
logger = logging.getLogger("pycalver2.v1rewrite")
|
||||
|
||||
|
||||
def rewrite_lines(
|
||||
|
|
@ -14,7 +14,7 @@ import lexid
|
|||
from . import version
|
||||
from . import v1patterns
|
||||
|
||||
logger = logging.getLogger("pycalver.v1version")
|
||||
logger = logging.getLogger("pycalver2.v1version")
|
||||
|
||||
|
||||
CalInfo = typ.Union[version.V1CalendarInfo, version.V1VersionInfo]
|
||||
|
|
@ -97,7 +97,7 @@ def _parse_field_values(field_values: FieldValues) -> version.V1VersionInfo:
|
|||
tag = fvals.get('tag')
|
||||
if tag is None:
|
||||
tag = "final"
|
||||
tag = version.RELEASE_BY_PEP440_TAG.get(tag, tag)
|
||||
tag = version.TAG_BY_PEP440_TAG.get(tag, tag)
|
||||
assert tag is not None
|
||||
|
||||
bid = fvals['bid'] if 'bid' in fvals else "0001"
|
||||
|
|
@ -351,7 +351,7 @@ def format_version(vinfo: version.V1VersionInfo, raw_pattern: str) -> str:
|
|||
kwargs['pep440_tag'] = ""
|
||||
else:
|
||||
kwargs['release' ] = "-" + release_tag
|
||||
kwargs['pep440_tag'] = version.PEP440_TAG_BY_RELEASE[release_tag] + "0"
|
||||
kwargs['pep440_tag'] = version.PEP440_TAG_BY_TAG[release_tag] + "0"
|
||||
|
||||
kwargs['release_tag'] = release_tag
|
||||
|
||||
|
|
@ -381,13 +381,13 @@ def incr(
|
|||
old_version: str,
|
||||
raw_pattern: str = "{pycalver}",
|
||||
*,
|
||||
tag : typ.Optional[str] = None,
|
||||
major : bool = False,
|
||||
minor : bool = False,
|
||||
patch : bool = False,
|
||||
release_num: bool = False,
|
||||
pin_date : bool = False,
|
||||
date : typ.Optional[dt.date] = None,
|
||||
major : bool = False,
|
||||
minor : bool = False,
|
||||
patch : bool = False,
|
||||
tag : typ.Optional[str] = None,
|
||||
tag_num : bool = False,
|
||||
pin_date: bool = False,
|
||||
date : typ.Optional[dt.date] = None,
|
||||
) -> typ.Optional[str]:
|
||||
"""Increment version string.
|
||||
|
||||
|
|
@ -415,8 +415,8 @@ def incr(
|
|||
cur_vinfo = cur_vinfo._replace(minor=cur_vinfo.minor + 1, patch=0)
|
||||
if patch:
|
||||
cur_vinfo = cur_vinfo._replace(patch=cur_vinfo.patch + 1)
|
||||
if release_num:
|
||||
raise NotImplementedError("--release-num not supported for old style patterns")
|
||||
if tag_num:
|
||||
raise NotImplementedError("--tag-num not supported for old style patterns")
|
||||
if tag:
|
||||
cur_vinfo = cur_vinfo._replace(tag=tag)
|
||||
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
"""Compose Regular Expressions from Patterns.
|
||||
|
||||
>>> pattern = compile_pattern("vYYYY0M.BUILD[-RELEASE]")
|
||||
>>> pattern = compile_pattern("vYYYY0M.BUILD[-TAG]")
|
||||
>>> version_info = pattern.regexp.match("v201712.0123-alpha")
|
||||
>>> assert version_info.groupdict() == {
|
||||
... "year_y" : "2017",
|
||||
|
|
@ -37,7 +37,7 @@ from . import utils
|
|||
from .patterns import RE_PATTERN_ESCAPES
|
||||
from .patterns import Pattern
|
||||
|
||||
logger = logging.getLogger("pycalver.v2patterns")
|
||||
logger = logging.getLogger("pycalver2.v2patterns")
|
||||
|
||||
# NOTE (mb 2020-09-17): For patterns with different options '(AAA|BB|C)', the
|
||||
# patterns with more digits should be first/left of those with fewer digits:
|
||||
|
|
@ -78,61 +78,61 @@ PART_PATTERNS = {
|
|||
'VV': r"5[0-3]|[1-4][0-9]|[1-9]",
|
||||
'0V': r"5[0-3]|[1-4][0-9]|0[1-9]",
|
||||
# non calver parts
|
||||
'MAJOR' : r"[0-9]+",
|
||||
'MINOR' : r"[0-9]+",
|
||||
'PATCH' : r"[0-9]+",
|
||||
'BUILD' : r"[0-9]+",
|
||||
'BLD' : r"[1-9][0-9]*",
|
||||
'RELEASE': r"preview|final|alpha|beta|post|rc",
|
||||
'PYTAG' : r"post|rc|a|b",
|
||||
'NUM' : r"[0-9]+",
|
||||
'INC0' : r"[0-9]+",
|
||||
'INC1' : r"[1-9][0-9]*",
|
||||
'MAJOR': r"[0-9]+",
|
||||
'MINOR': r"[0-9]+",
|
||||
'PATCH': r"[0-9]+",
|
||||
'BUILD': r"[0-9]+",
|
||||
'BLD' : r"[1-9][0-9]*",
|
||||
'TAG' : r"preview|final|alpha|beta|post|rc",
|
||||
'PYTAG': r"post|rc|a|b",
|
||||
'NUM' : r"[0-9]+",
|
||||
'INC0' : r"[0-9]+",
|
||||
'INC1' : r"[1-9][0-9]*",
|
||||
}
|
||||
|
||||
|
||||
PATTERN_PART_FIELDS = {
|
||||
'YYYY' : 'year_y',
|
||||
'YY' : 'year_y',
|
||||
'0Y' : 'year_y',
|
||||
'GGGG' : 'year_g',
|
||||
'GG' : 'year_g',
|
||||
'0G' : 'year_g',
|
||||
'Q' : 'quarter',
|
||||
'MM' : 'month',
|
||||
'0M' : 'month',
|
||||
'DD' : 'dom',
|
||||
'0D' : 'dom',
|
||||
'JJJ' : 'doy',
|
||||
'00J' : 'doy',
|
||||
'MAJOR' : 'major',
|
||||
'MINOR' : 'minor',
|
||||
'PATCH' : 'patch',
|
||||
'BUILD' : 'bid',
|
||||
'BLD' : 'bid',
|
||||
'RELEASE': 'tag',
|
||||
'PYTAG' : 'pytag',
|
||||
'NUM' : 'num',
|
||||
'INC0' : 'inc0',
|
||||
'INC1' : 'inc1',
|
||||
'WW' : 'week_w',
|
||||
'0W' : 'week_w',
|
||||
'UU' : 'week_u',
|
||||
'0U' : 'week_u',
|
||||
'VV' : 'week_v',
|
||||
'0V' : 'week_v',
|
||||
'YYYY' : 'year_y',
|
||||
'YY' : 'year_y',
|
||||
'0Y' : 'year_y',
|
||||
'GGGG' : 'year_g',
|
||||
'GG' : 'year_g',
|
||||
'0G' : 'year_g',
|
||||
'Q' : 'quarter',
|
||||
'MM' : 'month',
|
||||
'0M' : 'month',
|
||||
'DD' : 'dom',
|
||||
'0D' : 'dom',
|
||||
'JJJ' : 'doy',
|
||||
'00J' : 'doy',
|
||||
'MAJOR': 'major',
|
||||
'MINOR': 'minor',
|
||||
'PATCH': 'patch',
|
||||
'BUILD': 'bid',
|
||||
'BLD' : 'bid',
|
||||
'TAG' : 'tag',
|
||||
'PYTAG': 'pytag',
|
||||
'NUM' : 'num',
|
||||
'INC0' : 'inc0',
|
||||
'INC1' : 'inc1',
|
||||
'WW' : 'week_w',
|
||||
'0W' : 'week_w',
|
||||
'UU' : 'week_u',
|
||||
'0U' : 'week_u',
|
||||
'VV' : 'week_v',
|
||||
'0V' : 'week_v',
|
||||
}
|
||||
|
||||
|
||||
PEP440_PART_SUBSTITUTIONS = {
|
||||
'0W' : "WW",
|
||||
'0U' : "UU",
|
||||
'0V' : "VV",
|
||||
'0M' : "MM",
|
||||
'0D' : "DD",
|
||||
'00J' : "JJJ",
|
||||
'BUILD' : "BLD",
|
||||
'RELEASE': "PYTAG",
|
||||
'0W' : "WW",
|
||||
'0U' : "UU",
|
||||
'0V' : "VV",
|
||||
'0M' : "MM",
|
||||
'0D' : "DD",
|
||||
'00J' : "JJJ",
|
||||
'BUILD': "BLD",
|
||||
'TAG' : "PYTAG",
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -191,35 +191,35 @@ FormatterFunc = typ.Callable[[FieldValue], str]
|
|||
|
||||
|
||||
PART_FORMATS: typ.Dict[str, FormatterFunc] = {
|
||||
'YYYY' : _fmt_num,
|
||||
'YY' : _fmt_yy,
|
||||
'0Y' : _fmt_0y,
|
||||
'GGGG' : _fmt_num,
|
||||
'GG' : _fmt_gg,
|
||||
'0G' : _fmt_0g,
|
||||
'Q' : _fmt_num,
|
||||
'MM' : _fmt_num,
|
||||
'0M' : _fmt_0m,
|
||||
'DD' : _fmt_num,
|
||||
'0D' : _fmt_0d,
|
||||
'JJJ' : _fmt_num,
|
||||
'00J' : _fmt_00j,
|
||||
'MAJOR' : _fmt_num,
|
||||
'MINOR' : _fmt_num,
|
||||
'PATCH' : _fmt_num,
|
||||
'BUILD' : _fmt_num,
|
||||
'BLD' : _fmt_bld,
|
||||
'RELEASE': _fmt_num,
|
||||
'PYTAG' : _fmt_num,
|
||||
'NUM' : _fmt_num,
|
||||
'INC0' : _fmt_num,
|
||||
'INC1' : _fmt_num,
|
||||
'WW' : _fmt_num,
|
||||
'0W' : _fmt_0w,
|
||||
'UU' : _fmt_num,
|
||||
'0U' : _fmt_0u,
|
||||
'VV' : _fmt_num,
|
||||
'0V' : _fmt_0v,
|
||||
'YYYY' : _fmt_num,
|
||||
'YY' : _fmt_yy,
|
||||
'0Y' : _fmt_0y,
|
||||
'GGGG' : _fmt_num,
|
||||
'GG' : _fmt_gg,
|
||||
'0G' : _fmt_0g,
|
||||
'Q' : _fmt_num,
|
||||
'MM' : _fmt_num,
|
||||
'0M' : _fmt_0m,
|
||||
'DD' : _fmt_num,
|
||||
'0D' : _fmt_0d,
|
||||
'JJJ' : _fmt_num,
|
||||
'00J' : _fmt_00j,
|
||||
'MAJOR': _fmt_num,
|
||||
'MINOR': _fmt_num,
|
||||
'PATCH': _fmt_num,
|
||||
'BUILD': _fmt_num,
|
||||
'BLD' : _fmt_bld,
|
||||
'TAG' : _fmt_num,
|
||||
'PYTAG': _fmt_num,
|
||||
'NUM' : _fmt_num,
|
||||
'INC0' : _fmt_num,
|
||||
'INC1' : _fmt_num,
|
||||
'WW' : _fmt_num,
|
||||
'0W' : _fmt_0w,
|
||||
'UU' : _fmt_num,
|
||||
'0U' : _fmt_0u,
|
||||
'VV' : _fmt_num,
|
||||
'0V' : _fmt_0v,
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -249,7 +249,7 @@ def _convert_to_pep440(version_pattern: str) -> str:
|
|||
|
||||
substitution = PEP440_PART_SUBSTITUTIONS[part_name]
|
||||
|
||||
is_numerical_part = part_name not in ('RELEASE', 'PYTAG')
|
||||
is_numerical_part = part_name not in ('TAG', 'PYTAG')
|
||||
if is_numerical_part:
|
||||
part_index = pep440_pattern.find(part_name)
|
||||
is_zero_truncation_part = part_index == 0 or pep440_pattern[part_index - 1] == "."
|
||||
|
|
@ -321,7 +321,7 @@ def _replace_pattern_parts(pattern: str) -> str:
|
|||
def _compile_pattern_re(normalized_pattern: str) -> typ.Pattern[str]:
|
||||
escaped_pattern = normalized_pattern
|
||||
for char, escaped in RE_PATTERN_ESCAPES:
|
||||
# [] braces are used for optional parts, such as [-RELEASE]/[-beta]
|
||||
# [] braces are used for optional parts, such as [-TAG]/[-beta]
|
||||
# and need to be escaped manually.
|
||||
is_semantic_char = char in "[]\\"
|
||||
if not is_semantic_char:
|
||||
|
|
@ -18,7 +18,7 @@ from . import v2version
|
|||
from . import v2patterns
|
||||
from .patterns import Pattern
|
||||
|
||||
logger = logging.getLogger("pycalver.v2rewrite")
|
||||
logger = logging.getLogger("pycalver2.v2rewrite")
|
||||
|
||||
|
||||
def rewrite_lines(
|
||||
|
|
@ -65,9 +65,9 @@ def rfd_from_content(
|
|||
r"""Rewrite pattern occurrences with version string.
|
||||
|
||||
>>> from .v2patterns import compile_pattern
|
||||
>>> version_pattern = "vYYYY0M.BUILD[-RELEASE]"
|
||||
>>> version_pattern = "vYYYY0M.BUILD[-TAG]"
|
||||
>>> new_vinfo = v2version.parse_version_info("v201809.0123", version_pattern)
|
||||
>>> patterns = [compile_pattern(version_pattern, '__version__ = "vYYYY0M.BUILD[-RELEASE]"')]
|
||||
>>> patterns = [compile_pattern(version_pattern, '__version__ = "vYYYY0M.BUILD[-TAG]"')]
|
||||
>>> content = '__version__ = "v201809.0001-alpha"'
|
||||
>>> rfd = rfd_from_content(patterns, new_vinfo, content)
|
||||
>>> rfd.new_lines
|
||||
|
|
@ -14,7 +14,7 @@ import lexid
|
|||
from . import version
|
||||
from . import v2patterns
|
||||
|
||||
logger = logging.getLogger("pycalver.v2version")
|
||||
logger = logging.getLogger("pycalver2.v2version")
|
||||
|
||||
|
||||
CalInfo = typ.Union[version.V2CalendarInfo, version.V2VersionInfo]
|
||||
|
|
@ -218,9 +218,9 @@ def parse_field_values_to_vinfo(field_values: FieldValues) -> version.V2VersionI
|
|||
pytag = fvals.get('pytag') or ""
|
||||
|
||||
if tag and not pytag:
|
||||
pytag = version.PEP440_TAG_BY_RELEASE[tag]
|
||||
pytag = version.PEP440_TAG_BY_TAG[tag]
|
||||
elif pytag and not tag:
|
||||
tag = version.RELEASE_BY_PEP440_TAG[pytag]
|
||||
tag = version.TAG_BY_PEP440_TAG[pytag]
|
||||
|
||||
if not tag:
|
||||
tag = "final"
|
||||
|
|
@ -257,15 +257,15 @@ def parse_field_values_to_vinfo(field_values: FieldValues) -> version.V2VersionI
|
|||
|
||||
|
||||
def parse_version_info(
|
||||
version_str: str, raw_pattern: str = "vYYYY0M.BUILD[-RELEASE]"
|
||||
version_str: str, raw_pattern: str = "vYYYY0M.BUILD[-TAG]"
|
||||
) -> version.V2VersionInfo:
|
||||
"""Parse normalized V2VersionInfo.
|
||||
|
||||
>>> vinfo = parse_version_info("v201712.0033-beta", raw_pattern="vYYYY0M.BUILD[-RELEASE]")
|
||||
>>> vinfo = parse_version_info("v201712.0033-beta", raw_pattern="vYYYY0M.BUILD[-TAG]")
|
||||
>>> fvals = {'year_y': 2017, 'month': 12, 'bid': "0033", 'tag': "beta"}
|
||||
>>> assert vinfo == parse_field_values_to_vinfo(fvals)
|
||||
|
||||
>>> vinfo = parse_version_info("v201712.0033", raw_pattern="vYYYY0M.BUILD[-RELEASE]")
|
||||
>>> vinfo = parse_version_info("v201712.0033", raw_pattern="vYYYY0M.BUILD[-TAG]")
|
||||
>>> fvals = {'year_y': 2017, 'month': 12, 'bid': "0033"}
|
||||
>>> assert vinfo == parse_field_values_to_vinfo(fvals)
|
||||
|
||||
|
|
@ -296,10 +296,10 @@ def parse_version_info(
|
|||
return parse_field_values_to_vinfo(field_values)
|
||||
|
||||
|
||||
def is_valid(version_str: str, raw_pattern: str = "vYYYY0M.BUILD[-RELEASE]") -> bool:
|
||||
def is_valid(version_str: str, raw_pattern: str = "vYYYY.BUILD[-TAG]") -> bool:
|
||||
"""Check if a version matches a pattern.
|
||||
|
||||
>>> is_valid("v201712.0033-beta", raw_pattern="vYYYY0M.BUILD[-RELEASE]")
|
||||
>>> is_valid("v201712.0033-beta", raw_pattern="vYYYY0M.BUILD[-TAG]")
|
||||
True
|
||||
>>> is_valid("v201712.0033-beta", raw_pattern="MAJOR.MINOR.PATCH")
|
||||
False
|
||||
|
|
@ -327,9 +327,9 @@ def _format_part_values(vinfo: version.V2VersionInfo) -> PartValues:
|
|||
It may for example have month=9, but not the formatted
|
||||
representation '09' for '0M'.
|
||||
|
||||
>>> vinfo = parse_version_info("v200709.1033-beta", raw_pattern="vYYYY0M.BUILD[-RELEASE]")
|
||||
>>> vinfo = parse_version_info("v200709.1033-beta", raw_pattern="vYYYY0M.BUILD[-TAG]")
|
||||
>>> kwargs = dict(_format_part_values(vinfo))
|
||||
>>> (kwargs['YYYY'], kwargs['0M'], kwargs['BUILD'], kwargs['RELEASE'])
|
||||
>>> (kwargs['YYYY'], kwargs['0M'], kwargs['BUILD'], kwargs['TAG'])
|
||||
('2007', '09', '1033', 'beta')
|
||||
>>> (kwargs['YY'], kwargs['0Y'], kwargs['MM'], kwargs['PYTAG'])
|
||||
('7', '07', '9', 'b')
|
||||
|
|
@ -472,7 +472,7 @@ def format_version(vinfo: version.V2VersionInfo, raw_pattern: str) -> str:
|
|||
"""Generate version string.
|
||||
|
||||
>>> import datetime as dt
|
||||
>>> vinfo = parse_version_info("v200712.0033-beta", raw_pattern="vYYYY0M.BUILD[-RELEASE]")
|
||||
>>> vinfo = parse_version_info("v200712.0033-beta", raw_pattern="vYYYY0M.BUILD[-TAG]")
|
||||
>>> vinfo_a = vinfo._replace(**cal_info(date=dt.date(2007, 1, 1))._asdict())
|
||||
>>> vinfo_b = vinfo._replace(**cal_info(date=dt.date(2007, 12, 31))._asdict())
|
||||
|
||||
|
|
@ -483,63 +483,63 @@ def format_version(vinfo: version.V2VersionInfo, raw_pattern: str) -> str:
|
|||
'v7.33-b0'
|
||||
>>> format_version(vinfo_a, raw_pattern="YYYY0M.BUILD[PYTAG[NUM]]")
|
||||
'200701.0033b'
|
||||
>>> format_version(vinfo_a, raw_pattern="v0Y.BLD[-RELEASE]")
|
||||
>>> format_version(vinfo_a, raw_pattern="v0Y.BLD[-TAG]")
|
||||
'v07.33-beta'
|
||||
|
||||
>>> format_version(vinfo_a, raw_pattern="vYYYY0M.BUILD[-RELEASE]")
|
||||
>>> format_version(vinfo_a, raw_pattern="vYYYY0M.BUILD[-TAG]")
|
||||
'v200701.0033-beta'
|
||||
>>> format_version(vinfo_b, raw_pattern="vYYYY0M.BUILD[-RELEASE]")
|
||||
>>> format_version(vinfo_b, raw_pattern="vYYYY0M.BUILD[-TAG]")
|
||||
'v200712.0033-beta'
|
||||
|
||||
>>> format_version(vinfo_a, raw_pattern="vYYYYw0W.BUILD[-RELEASE]")
|
||||
>>> format_version(vinfo_a, raw_pattern="vYYYYw0W.BUILD[-TAG]")
|
||||
'v2007w01.0033-beta'
|
||||
>>> format_version(vinfo_a, raw_pattern="vYYYYwWW.BLD[-RELEASE]")
|
||||
>>> format_version(vinfo_a, raw_pattern="vYYYYwWW.BLD[-TAG]")
|
||||
'v2007w1.33-beta'
|
||||
>>> format_version(vinfo_b, raw_pattern="vYYYYw0W.BUILD[-RELEASE]")
|
||||
>>> format_version(vinfo_b, raw_pattern="vYYYYw0W.BUILD[-TAG]")
|
||||
'v2007w53.0033-beta'
|
||||
|
||||
>>> format_version(vinfo_a, raw_pattern="vYYYYd00J.BUILD[-RELEASE]")
|
||||
>>> format_version(vinfo_a, raw_pattern="vYYYYd00J.BUILD[-TAG]")
|
||||
'v2007d001.0033-beta'
|
||||
>>> format_version(vinfo_a, raw_pattern="vYYYYdJJJ.BUILD[-RELEASE]")
|
||||
>>> format_version(vinfo_a, raw_pattern="vYYYYdJJJ.BUILD[-TAG]")
|
||||
'v2007d1.0033-beta'
|
||||
>>> format_version(vinfo_b, raw_pattern="vYYYYd00J.BUILD[-RELEASE]")
|
||||
>>> format_version(vinfo_b, raw_pattern="vYYYYd00J.BUILD[-TAG]")
|
||||
'v2007d365.0033-beta'
|
||||
|
||||
>>> format_version(vinfo_a, raw_pattern="vGGGGwVV.BLD[PYTAGNUM]")
|
||||
'v2007w1.33b0'
|
||||
>>> format_version(vinfo_a, raw_pattern="vGGGGw0V.BUILD[-RELEASE]")
|
||||
>>> format_version(vinfo_a, raw_pattern="vGGGGw0V.BUILD[-TAG]")
|
||||
'v2007w01.0033-beta'
|
||||
>>> format_version(vinfo_b, raw_pattern="vGGGGw0V.BUILD[-RELEASE]")
|
||||
>>> format_version(vinfo_b, raw_pattern="vGGGGw0V.BUILD[-TAG]")
|
||||
'v2008w01.0033-beta'
|
||||
|
||||
>>> vinfo_c = vinfo_b._replace(major=1, minor=2, patch=34, tag='final')
|
||||
|
||||
>>> format_version(vinfo_c, raw_pattern="vYYYYwWW.BUILD-RELEASE")
|
||||
>>> format_version(vinfo_c, raw_pattern="vYYYYwWW.BUILD-TAG")
|
||||
'v2007w53.0033-final'
|
||||
>>> format_version(vinfo_c, raw_pattern="vYYYYwWW.BUILD[-RELEASE]")
|
||||
>>> format_version(vinfo_c, raw_pattern="vYYYYwWW.BUILD[-TAG]")
|
||||
'v2007w53.0033'
|
||||
|
||||
>>> format_version(vinfo_c, raw_pattern="vMAJOR.MINOR.PATCH")
|
||||
'v1.2.34'
|
||||
|
||||
>>> vinfo_d = vinfo_b._replace(major=1, minor=0, patch=0, tag='final')
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR.MINOR.PATCH-RELEASENUM")
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR.MINOR.PATCH-TAGNUM")
|
||||
'v1.0.0-final0'
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR.MINOR.PATCH-RELEASE")
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR.MINOR.PATCH-TAG")
|
||||
'v1.0.0-final'
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR.MINOR.PATCH-RELEASE")
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR.MINOR.PATCH-TAG")
|
||||
'v1.0.0-final'
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR.MINOR.PATCH[-RELEASE]")
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR.MINOR.PATCH[-TAG]")
|
||||
'v1.0.0'
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR.MINOR[.PATCH[-RELEASE]]")
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR.MINOR[.PATCH[-TAG]]")
|
||||
'v1.0'
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR[.MINOR[.PATCH[-RELEASE]]]")
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR[.MINOR[.PATCH[-TAG]]]")
|
||||
'v1'
|
||||
|
||||
>>> vinfo_d = vinfo_b._replace(major=1, minor=0, patch=2, tag='rc', pytag='rc', num=0)
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR[.MINOR[.PATCH]]")
|
||||
'v1.0.2'
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR[.MINOR[.PATCH[-RELEASE]]]")
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR[.MINOR[.PATCH[-TAG]]]")
|
||||
'v1.0.2-rc'
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR[.MINOR[.PATCH[PYTAGNUM]]]")
|
||||
'v1.0.2rc0'
|
||||
|
|
@ -547,11 +547,11 @@ def format_version(vinfo: version.V2VersionInfo, raw_pattern: str) -> str:
|
|||
'v1.0.2'
|
||||
|
||||
>>> vinfo_d = vinfo_b._replace(major=1, minor=0, patch=0, tag='rc', num=2)
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR[.MINOR[.PATCH[-RELEASENUM]]]")
|
||||
>>> format_version(vinfo_d, raw_pattern="vMAJOR[.MINOR[.PATCH[-TAGNUM]]]")
|
||||
'v1.0.0-rc2'
|
||||
|
||||
>>> vinfo_d = vinfo_b._replace(major=1, minor=0, patch=0, tag='rc', num=2)
|
||||
>>> format_version(vinfo_d, raw_pattern='__version__ = "vMAJOR[.MINOR[.PATCH[-RELEASENUM]]]"')
|
||||
>>> format_version(vinfo_d, raw_pattern='__version__ = "vMAJOR[.MINOR[.PATCH[-TAGNUM]]]"')
|
||||
'__version__ = "v1.0.0-rc2"'
|
||||
"""
|
||||
part_values = _format_part_values(vinfo)
|
||||
|
|
@ -615,7 +615,7 @@ def _incr_numeric(
|
|||
minor : bool,
|
||||
patch : bool,
|
||||
tag : typ.Optional[str],
|
||||
release_num: bool,
|
||||
tag_num : bool,
|
||||
) -> version.V2VersionInfo:
|
||||
# Reset major/minor/patch/num/inc to zero if any part to the left of it is incremented
|
||||
fields = _parse_pattern_fields(raw_pattern)
|
||||
|
|
@ -647,7 +647,7 @@ def _incr_numeric(
|
|||
cur_vinfo = cur_vinfo._replace(minor=cur_vinfo.minor + 1, patch=0)
|
||||
if patch and 'patch' not in reset_fields:
|
||||
cur_vinfo = cur_vinfo._replace(patch=cur_vinfo.patch + 1)
|
||||
if release_num and 'release_num' not in reset_fields:
|
||||
if tag_num and 'tag_num' not in reset_fields:
|
||||
cur_vinfo = cur_vinfo._replace(num=cur_vinfo.num + 1)
|
||||
if tag and 'tag' not in reset_fields:
|
||||
if tag != cur_vinfo.tag:
|
||||
|
|
@ -677,15 +677,15 @@ def is_valid_week_pattern(raw_pattern: str) -> bool:
|
|||
|
||||
def incr(
|
||||
old_version: str,
|
||||
raw_pattern: str = "vYYYY0M.BUILD[-RELEASE]",
|
||||
raw_pattern: str = "vYYYY0M.BUILD[-TAG]",
|
||||
*,
|
||||
tag : typ.Optional[str] = None,
|
||||
major : bool = False,
|
||||
minor : bool = False,
|
||||
patch : bool = False,
|
||||
release_num: bool = False,
|
||||
pin_date : bool = False,
|
||||
date : typ.Optional[dt.date] = None,
|
||||
major : bool = False,
|
||||
minor : bool = False,
|
||||
patch : bool = False,
|
||||
tag : typ.Optional[str] = None,
|
||||
tag_num : bool = False,
|
||||
pin_date: bool = False,
|
||||
date : typ.Optional[dt.date] = None,
|
||||
) -> typ.Optional[str]:
|
||||
"""Increment version string.
|
||||
|
||||
|
|
@ -716,7 +716,7 @@ def incr(
|
|||
minor=minor,
|
||||
patch=patch,
|
||||
tag=tag,
|
||||
release_num=release_num,
|
||||
tag_num=tag_num,
|
||||
)
|
||||
|
||||
new_version = format_version(cur_vinfo, raw_pattern)
|
||||
|
|
@ -24,7 +24,7 @@ import subprocess as sp
|
|||
|
||||
from pycalver import config
|
||||
|
||||
logger = logging.getLogger("pycalver.vcs")
|
||||
logger = logging.getLogger("pycalver2.vcs")
|
||||
|
||||
|
||||
VCS_SUBCOMMANDS_BY_NAME = {
|
||||
|
|
@ -81,7 +81,7 @@ class V2VersionInfo(typ.NamedTuple):
|
|||
TODAY = dt.datetime.utcnow().date()
|
||||
|
||||
|
||||
RELEASE_BY_PEP440_TAG = {
|
||||
TAG_BY_PEP440_TAG = {
|
||||
'a' : 'alpha',
|
||||
'b' : 'beta',
|
||||
'' : 'final',
|
||||
|
|
@ -91,7 +91,7 @@ RELEASE_BY_PEP440_TAG = {
|
|||
}
|
||||
|
||||
|
||||
PEP440_TAG_BY_RELEASE = {
|
||||
PEP440_TAG_BY_TAG = {
|
||||
'a' : 'a',
|
||||
'b' : 'b',
|
||||
'dev' : 'dev',
|
||||
|
|
@ -107,18 +107,18 @@ PEP440_TAG_BY_RELEASE = {
|
|||
'rev' : 'post',
|
||||
}
|
||||
|
||||
assert set(RELEASE_BY_PEP440_TAG.keys()) == set(PEP440_TAG_BY_RELEASE.values())
|
||||
assert set(RELEASE_BY_PEP440_TAG.values()) < set(PEP440_TAG_BY_RELEASE.keys())
|
||||
assert set(TAG_BY_PEP440_TAG.keys()) == set(PEP440_TAG_BY_TAG.values())
|
||||
assert set(TAG_BY_PEP440_TAG.values()) < set(PEP440_TAG_BY_TAG.keys())
|
||||
|
||||
|
||||
PART_ZERO_VALUES = {
|
||||
'MAJOR' : "0",
|
||||
'MINOR' : "0",
|
||||
'PATCH' : "0",
|
||||
'RELEASE': "final",
|
||||
'PYTAG' : "",
|
||||
'NUM' : "0",
|
||||
'INC0' : "0",
|
||||
'MAJOR': "0",
|
||||
'MINOR': "0",
|
||||
'PATCH': "0",
|
||||
'TAG' : "final",
|
||||
'PYTAG': "",
|
||||
'NUM' : "0",
|
||||
'INC0' : "0",
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue