From 6340374eb2954996a8e04f5860b6c4db6ff3e123 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> Date: Tue, 18 Jan 2022 10:58:12 +0100 Subject: [PATCH] fix #669: restore old get_version signature --- CHANGELOG.rst | 4 ++++ src/setuptools_scm/__init__.py | 22 +++++++++++++++++++--- testing/test_basic_api.py | 9 ++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 537b9ec0..aa372dc9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,4 +1,8 @@ +v6.4.1 +======= + +* fix regression #669: restore get_version signature 6.4.0 ====== diff --git a/src/setuptools_scm/__init__.py b/src/setuptools_scm/__init__.py index 4c91a365..eb671f7f 100644 --- a/src/setuptools_scm/__init__.py +++ b/src/setuptools_scm/__init__.py @@ -111,8 +111,24 @@ 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 @@ -120,7 +136,7 @@ def get_version(**kw) -> str: 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) diff --git a/testing/test_basic_api.py b/testing/test_basic_api.py index bb3b4ed8..55bf3461 100644 --- a/testing/test_basic_api.py +++ b/testing/test_basic_api.py @@ -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):