From 2205575556d94f88ccc77193c82180c28c4c9847 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 30 Jun 2022 17:17:16 -0400 Subject: [PATCH] Updated setuptools_scm 7 patch The patch is based on the updated, approved version of upstream PR#9. --- 9.patch | 103 +++++++++++++++++++++++++++++++++++++++++- python-hatch-vcs.spec | 1 - 2 files changed, 102 insertions(+), 2 deletions(-) diff --git a/9.patch b/9.patch index 1fe6341..1162cae 100644 --- a/9.patch +++ b/9.patch @@ -1,7 +1,7 @@ From 22af1c13f637587c0182b3363e98d15f7e150eb7 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Thu, 30 Jun 2022 14:05:02 +0200 -Subject: [PATCH] Fix test compatibility with setuptools_scm 7 +Subject: [PATCH 1/4] Fix test compatibility with setuptools_scm 7 --- hatch.toml | 1 + @@ -48,3 +48,104 @@ index 2d719a9..a4f88fd 100644 @pytest.mark.skipif(sys.version_info[0] == 2, reason='Depends on fix in 6.4.0 which is Python 3-only') + +From 234285322bc655885da1cebed510bba6c7960232 Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Thu, 30 Jun 2022 22:35:53 +0200 +Subject: [PATCH 2/4] Revert "Fix test compatibility with setuptools_scm 7" + +This reverts commit 22af1c13f637587c0182b3363e98d15f7e150eb7. +--- + hatch.toml | 1 - + tests/test_build.py | 8 +------- + 2 files changed, 1 insertion(+), 8 deletions(-) + +diff --git a/hatch.toml b/hatch.toml +index 22c9f86..269801a 100644 +--- a/hatch.toml ++++ b/hatch.toml +@@ -1,6 +1,5 @@ + [envs.default] + dependencies = [ +- "importlib-metadata", + "pytest", + "pytest-cov", + ] +diff --git a/tests/test_build.py b/tests/test_build.py +index a4f88fd..2d719a9 100644 +--- a/tests/test_build.py ++++ b/tests/test_build.py +@@ -6,12 +6,9 @@ + import zipfile + + import pytest +-from importlib_metadata import version + + from .utils import build_project, read_file + +-setuptools_scm_major = int(version("setuptools_scm").split(".")[0]) +- + + def test_basic(new_project_basic): + build_project('-t', 'wheel') +@@ -78,10 +75,7 @@ def test_write(new_project_write): + assert os.path.isfile(version_file) + + lines = read_file(version_file).splitlines() +- if setuptools_scm_major < 7: +- assert lines[3] == "version = '1.2.3'" +- else: +- assert lines[3] == "__version__ = version = '1.2.3'" ++ assert lines[3] == "version = '1.2.3'" + + + @pytest.mark.skipif(sys.version_info[0] == 2, reason='Depends on fix in 6.4.0 which is Python 3-only') + +From 46b2c3e21ad229887ad4bf20c24b5ff5ad3e3c0e Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Thu, 30 Jun 2022 22:39:39 +0200 +Subject: [PATCH 3/4] Fix test compatibility with setuptools_scm 7 + +--- + tests/test_build.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/test_build.py b/tests/test_build.py +index 2d719a9..ca82d9d 100644 +--- a/tests/test_build.py ++++ b/tests/test_build.py +@@ -75,7 +75,8 @@ def test_write(new_project_write): + assert os.path.isfile(version_file) + + lines = read_file(version_file).splitlines() +- assert lines[3] == "version = '1.2.3'" ++ assert lines[3].startswith("version =") or lines[3].startswith("__version__ =") ++ assert lines[3].endswith("version = '1.2.3'") + + + @pytest.mark.skipif(sys.version_info[0] == 2, reason='Depends on fix in 6.4.0 which is Python 3-only') + +From d25f23e0c598c7f4a1c699b9b9aa83a24cdbd505 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lum=C3=ADr=20=27Frenzy=27=20Balhar?= + +Date: Thu, 30 Jun 2022 22:43:44 +0200 +Subject: [PATCH 4/4] Update tests/test_build.py + +Co-authored-by: Ronny Pfannschmidt +--- + tests/test_build.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_build.py b/tests/test_build.py +index ca82d9d..303c76d 100644 +--- a/tests/test_build.py ++++ b/tests/test_build.py +@@ -75,7 +75,7 @@ def test_write(new_project_write): + assert os.path.isfile(version_file) + + lines = read_file(version_file).splitlines() +- assert lines[3].startswith("version =") or lines[3].startswith("__version__ =") ++ assert lines[3].startswith(("version =", "__version__ =")) + assert lines[3].endswith("version = '1.2.3'") + + diff --git a/python-hatch-vcs.spec b/python-hatch-vcs.spec index a1f114b..c3be04e 100644 --- a/python-hatch-vcs.spec +++ b/python-hatch-vcs.spec @@ -33,7 +33,6 @@ BuildRequires: pyproject-rpm-macros >= 1.2.0 %if %{with tests} BuildRequires: python3dist(pytest) -BuildRequires: python3dist(importlib-metadata) BuildRequires: git-core %endif