112 lines
6.2 KiB
Diff
112 lines
6.2 KiB
Diff
|
From d07463ea6afcecd83fd55bdac975516de6f3bc10 Mon Sep 17 00:00:00 2001
|
||
|
From: Ryan Morshead <ryan.morshead@gmail.com>
|
||
|
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(
|