Skip to content

Commit

Permalink
Merge pull request #670 from RonnyPfannschmidt/fix-669-get-version-si…
Browse files Browse the repository at this point in the history
…gnature

6.4.0 bugfixes
  • Loading branch information
RonnyPfannschmidt authored Jan 18, 2022
2 parents 4a1b43a + e28a7c9 commit c585e20
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
v6.4.1
=======


* fix regression #669: restore get_version signature
* fix #668: harden the selftest for distribution extras

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
4 changes: 2 additions & 2 deletions testing/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ def testwarn_on_broken_setuptools():


@pytest.mark.issue(611)
def test_provides_toml_exta():
def test_distribution_procides_extras():
try:
from importlib.metadata import distribution
except ImportError:
from importlib_metadata import distribution

dist = distribution("setuptools_scm")
assert "toml" in dist.metadata["Provides-Extra"]
assert sorted(dist.metadata.get_all("Provides-Extra")) == ["test", "toml"]

0 comments on commit c585e20

Please sign in to comment.