Skip to content

Commit

Permalink
rename version to version_str in dump_version
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiyuan Chen <chenzhiyuan@dp.tech>
  • Loading branch information
ZhiyuanChen committed May 25, 2023
1 parent ebbc395 commit 37cafa3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/setuptools_scm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,27 @@

def dump_version(
root: _t.PathT,
version: str,
version_str: str,
write_to: _t.PathT,
template: str | None = None,
) -> None:
assert isinstance(version, str)
assert isinstance(version_str, str)
target = os.path.normpath(os.path.join(root, write_to))
ext = os.path.splitext(target)[1]
template = template or TEMPLATES.get(ext)
from ._log import log

log.debug("dump %s into %s", version, write_to)
log.debug("dump %s into %s", version_str, write_to)
if template is None:
raise ValueError(
"bad file format: '{}' (of {}) \nonly *.txt and *.py are supported".format(
os.path.splitext(target)[1], target
)
)
version_tuple = _version_as_tuple(version)
version_tuple = _version_as_tuple(version_str)

with open(target, "w") as fp:
fp.write(template.format(version=version, version_tuple=version_tuple))
fp.write(template.format(version=version_str, version_tuple=version_tuple))


def _do_parse(config: Configuration) -> _t.SCMVERSION | None:
Expand Down Expand Up @@ -163,7 +163,7 @@ def _get_version(config: Configuration) -> str | None:
if config.write_to is not None:
dump_version(
root=config.root,
version=version_string,
version_str=version_string,
write_to=config.write_to,
template=config.write_to_template,
)
Expand Down

0 comments on commit 37cafa3

Please sign in to comment.