diff --git a/hatch-pr828-pth-tests.patch b/hatch-pr828-pth-tests.patch new file mode 100644 index 0000000..13c170b --- /dev/null +++ b/hatch-pr828-pth-tests.patch @@ -0,0 +1,111 @@ +From d07463ea6afcecd83fd55bdac975516de6f3bc10 Mon Sep 17 00:00:00 2001 +From: Ryan Morshead +Date: Mon, 17 Apr 2023 22:02:59 -0700 +Subject: [PATCH 1/3] Name .pth file so it loads first + +Users adding their own .pth files likely need to be loaded after the one inserted by hatchling. The only way to do this is by naming it so the hatchling .pth file comes first alphabetically. +--- + backend/src/hatchling/builders/wheel.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: hatch-hatch-v1.7.0/backend/src/hatchling/builders/wheel.py +=================================================================== +--- hatch-hatch-v1.7.0.orig/backend/src/hatchling/builders/wheel.py ++++ hatch-hatch-v1.7.0/backend/src/hatchling/builders/wheel.py +@@ -438,6 +438,9 @@ class WheelBuilder(BuilderInterface): + editable_project.add_to_path(os.path.dirname(relative_path)) + + for filename, content in sorted(editable_project.files()): ++ if filename.endswith('.pth') and not filename.startswith('_'): ++ filename = f'_{filename}' ++ + record = archive.write_file(filename, content) + records.write(record) + +@@ -475,7 +478,7 @@ class WheelBuilder(BuilderInterface): + for relative_directory in self.config.dev_mode_dirs + ) + +- record = archive.write_file(f"{self.metadata.core.name.replace('-', '_')}.pth", '\n'.join(directories)) ++ record = archive.write_file(f"_{self.metadata.core.name.replace('-', '_')}.pth", '\n'.join(directories)) + records.write(record) + + for included_file in self.recurse_forced_files(self.get_forced_inclusion_map(build_data)): +Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact.py +=================================================================== +--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_exact.py ++++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact.py +@@ -16,7 +16,7 @@ def get_files(**kwargs): + if str(f.path) == 'LICENSE.txt': + files.append(File(Path(metadata_directory, 'licenses', f.path), f.contents)) + +- pth_file_name = f"{kwargs['package_name']}.pth" ++ pth_file_name = f"_{kwargs['package_name']}.pth" + loader_file_name = f"_editable_impl_{kwargs['package_name']}.py" + files.append(File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}")) + files.append( +Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact_extra_dependencies.py +=================================================================== +--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_exact_extra_dependencies.py ++++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact_extra_dependencies.py +@@ -16,7 +16,7 @@ def get_files(**kwargs): + if str(f.path) == 'LICENSE.txt': + files.append(File(Path(metadata_directory, 'licenses', f.path), f.contents)) + +- pth_file_name = f"{kwargs['package_name']}.pth" ++ pth_file_name = f"_{kwargs['package_name']}.pth" + loader_file_name = f"_editable_impl_{kwargs['package_name']}.py" + files.append(File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}")) + files.append( +Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact_force_include.py +=================================================================== +--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_exact_force_include.py ++++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_exact_force_include.py +@@ -18,7 +18,7 @@ def get_files(**kwargs): + elif f.path.parts[-1] == '__about__.py': + files.append(File(Path('zfoo.py'), f.contents)) + +- pth_file_name = f"{kwargs['package_name']}.pth" ++ pth_file_name = f"_{kwargs['package_name']}.pth" + loader_file_name = f"_editable_impl_{kwargs['package_name']}.py" + files.append(File(Path(pth_file_name), f"import _editable_impl_{kwargs['package_name']}")) + files.append( +Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth.py +=================================================================== +--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_pth.py ++++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth.py +@@ -16,7 +16,7 @@ def get_files(**kwargs): + if str(f.path) == 'LICENSE.txt': + files.append(File(Path(metadata_directory, 'licenses', f.path), f.contents)) + +- pth_file_name = f"{kwargs['package_name']}.pth" ++ pth_file_name = f"_{kwargs['package_name']}.pth" + files.append(File(Path(pth_file_name), '\n'.join(package_paths))) + files.append( + File( +Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth_extra_dependencies.py +=================================================================== +--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_pth_extra_dependencies.py ++++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth_extra_dependencies.py +@@ -16,7 +16,7 @@ def get_files(**kwargs): + if str(f.path) == 'LICENSE.txt': + files.append(File(Path(metadata_directory, 'licenses', f.path), f.contents)) + +- pth_file_name = f"{kwargs['package_name']}.pth" ++ pth_file_name = f"_{kwargs['package_name']}.pth" + files.append(File(Path(pth_file_name), '\n'.join(package_paths))) + files.append( + File( +Index: hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth_force_include.py +=================================================================== +--- hatch-hatch-v1.7.0.orig/tests/helpers/templates/wheel/standard_editable_pth_force_include.py ++++ hatch-hatch-v1.7.0/tests/helpers/templates/wheel/standard_editable_pth_force_include.py +@@ -18,7 +18,7 @@ def get_files(**kwargs): + elif f.path.parts[-1] == '__about__.py': + files.append(File(Path('zfoo.py'), f.contents)) + +- pth_file_name = f"{kwargs['package_name']}.pth" ++ pth_file_name = f"_{kwargs['package_name']}.pth" + files.append(File(Path(pth_file_name), '\n'.join(package_paths))) + files.append( + File( diff --git a/python-hatch.changes b/python-hatch.changes index cc3fd4e..d4691d3 100644 --- a/python-hatch.changes +++ b/python-hatch.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Wed Jun 21 08:39:40 UTC 2023 - Ben Greiner + +- Add hatch-pr828-pth-tests.patch, gh#pypa/hatch#828 fixing + test failure with hatchling >= 1.17.1 + +------------------------------------------------------------------- +Sun Jun 11 08:38:31 UTC 2023 - ecsos + +- Add %{?sle15_python_module_pythons} + ------------------------------------------------------------------- Wed May 10 16:07:25 UTC 2023 - Daniel Garcia diff --git a/python-hatch.spec b/python-hatch.spec index 7ba33fb..32316e5 100644 --- a/python-hatch.spec +++ b/python-hatch.spec @@ -24,7 +24,7 @@ %define psuffix %{nil} %bcond_with test %endif - +%{?sle15_python_module_pythons} Name: python-hatch%{psuffix} Version: 1.7.0 Release: 0 @@ -35,6 +35,8 @@ URL: https://hatch.pypa.io/latest/ Source: https://github.com/pypa/hatch/archive/refs/tags/hatch-v%{version}.tar.gz # PATCH-FIX-UPSTREAM fix-sdist-target.patch -- gh#pypa/hatch@1b10663e645e Patch0: fix-sdist-target.patch +# PATCH-FIX-UPSTREAM hatch-pr828-pth-tests.patch, gh#pypa/hatch#828 +Patch1: hatch-pr828-pth-tests.patch BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module hatchling >= 1.14} BuildRequires: %{python_module pip} @@ -48,6 +50,8 @@ Requires: git-core %if %{with test} BuildRequires: %{python_module filelock >= 3.7.1} BuildRequires: %{python_module hatch = %{version}} +# Due to Patch1, gh#pypa/hatch#828 +BuildRequires: %{python_module hatchling >= 1.17.1} BuildRequires: %{python_module pytest-mock} BuildRequires: %{python_module pytest-randomly} BuildRequires: %{python_module pytest-rerunfailures}