Skip to content

Commit

Permalink
fix #669: restore old get_version signature
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed Jan 18, 2022
1 parent 4a1b43a commit 6340374
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
v6.4.1
=======


* fix regression #669: restore get_version signature

6.4.0
======
Expand Down
22 changes: 19 additions & 3 deletions src/setuptools_scm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,32 @@ def _version_missing(config) -> NoReturn:
)


@_types.transfer_input_args(Configuration)
def get_version(**kw) -> str:
def get_version(
root=".",
version_scheme=DEFAULT_VERSION_SCHEME,
local_scheme=DEFAULT_LOCAL_SCHEME,
write_to=None,
write_to_template=None,
relative_to=None,
tag_regex=DEFAULT_TAG_REGEX,
parentdir_prefix_version=None,
fallback_version=None,
fallback_root=".",
parse=None,
git_describe_command=None,
dist_name=None,
version_cls=None,
normalize=True,
search_parent_directories=False,
):
"""
If supplied, relative_to should be a file from which root may
be resolved. Typically called by a script or module that is not
in the root of the repository to direct setuptools_scm to the
root of the repository by supplying ``__file__``.
"""

config = Configuration(**kw)
config = Configuration(**locals())
maybe_version = _get_version(config)
if maybe_version is None:
_version_missing(config)
Expand Down
9 changes: 6 additions & 3 deletions testing/test_basic_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ def test_version_from_scm(wd):
setuptools_scm.version_from_scm(str(wd))


def test_root_parameter_pass_by(monkeypatch, tmpdir):
assert_root(monkeypatch, tmpdir)
setuptools_scm.get_version(root=tmpdir.strpath)
def test_root_parameter_pass_by(monkeypatch: pytest.MonkeyPatch, tmp_path: Path):
assert_root(monkeypatch, os.fspath(tmp_path))
setuptools_scm.get_version(root=os.fspath(tmp_path))
setuptools_scm.get_version(
os.fspath(tmp_path)
) # issue 669 - posarg difference between Configuration and get_version


def test_parentdir_prefix(tmpdir, monkeypatch):
Expand Down

0 comments on commit 6340374

Please sign in to comment.