From 9cf64cb02008bc26fba7e2a3f63d6e15b22e4abb Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Mon, 19 Dec 2022 20:38:33 -0500 Subject: [PATCH] Work with setuptools_scm 7.1 --- 26.patch | 29 +++++++++++++++++++++++++++++ python-hatch-vcs.spec | 6 +++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 26.patch diff --git a/26.patch b/26.patch new file mode 100644 index 0000000..b1cc55a --- /dev/null +++ b/26.patch @@ -0,0 +1,29 @@ +From 2bf0d32f92f6609258f85131b94d0952fc0ec149 Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Mon, 19 Dec 2022 20:20:11 -0500 +Subject: [PATCH] Work with setuptools_scm 7.1 (fix #25) + +Make test_write less brittle (see also #8, #9) so that it works with +_version.py files generated by at least setuptools_scm 7.1, 7.0, and +6.x. +--- + tests/test_build.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/tests/test_build.py b/tests/test_build.py +index 2fde601..7c76343 100644 +--- a/tests/test_build.py ++++ b/tests/test_build.py +@@ -75,8 +75,10 @@ def test_write(new_project_write): + assert os.path.isfile(version_file) + + lines = read_file(version_file).splitlines() +- assert lines[3].startswith(('version =', '__version__ =')) +- assert lines[3].endswith("version = '1.2.3'") ++ version_starts = ('version = ', '__version__ = ') ++ assert any(line.startswith(version_starts) for line in lines) ++ version_line = next(line for line in lines if line.startswith(version_starts)) ++ assert version_line.endswith(" = '1.2.3'") + + + @pytest.mark.skipif(sys.version_info[0] == 2, reason='Depends on fix in 6.4.0 which is Python 3-only') diff --git a/python-hatch-vcs.spec b/python-hatch-vcs.spec index c6f0422..dc8effe 100644 --- a/python-hatch-vcs.spec +++ b/python-hatch-vcs.spec @@ -19,6 +19,10 @@ Source0: %{pypi_source hatch_vcs} BuildArch: noarch +# Work with setuptools_scm 7.1 (fix #25) +# https://github.com/ofek/hatch-vcs/pull/26 +Patch: %{url}/pull/26.patch + BuildRequires: python3-devel %if %{with tests} @@ -40,7 +44,7 @@ Summary: %{summary} %prep -%autosetup -n hatch_vcs-%{version} +%autosetup -n hatch_vcs-%{version} -p1 %generate_buildrequires