python-package-folder 4.1.1__py3-none-any.whl → 4.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_package_folder/_hatch_build.py +15 -0
- python_package_folder/python_package_folder.py +37 -6
- {python_package_folder-4.1.1.dist-info → python_package_folder-4.1.3.dist-info}/METADATA +1 -1
- {python_package_folder-4.1.1.dist-info → python_package_folder-4.1.3.dist-info}/RECORD +7 -7
- {python_package_folder-4.1.1.dist-info → python_package_folder-4.1.3.dist-info}/WHEEL +0 -0
- {python_package_folder-4.1.1.dist-info → python_package_folder-4.1.3.dist-info}/entry_points.txt +0 -0
- {python_package_folder-4.1.1.dist-info → python_package_folder-4.1.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,6 +6,7 @@ in the wheel without creating duplicates, and automatically includes any new
|
|
|
6
6
|
files added to the directory without requiring manual configuration updates.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
+
import sys
|
|
9
10
|
from pathlib import Path
|
|
10
11
|
from typing import Any
|
|
11
12
|
|
|
@@ -21,6 +22,10 @@ class CustomBuildHook(BuildHookInterface):
|
|
|
21
22
|
source_dir = Path(self.root) / "src" / "python_package_folder"
|
|
22
23
|
scripts_dir = source_dir / "scripts"
|
|
23
24
|
|
|
25
|
+
# Debug: Print to stderr so it shows in build output
|
|
26
|
+
print(f"[DEBUG] Build hook called. Root: {self.root}", file=sys.stderr)
|
|
27
|
+
print(f"[DEBUG] Scripts dir exists: {scripts_dir.exists()}", file=sys.stderr)
|
|
28
|
+
|
|
24
29
|
# If scripts directory exists, include all files from it
|
|
25
30
|
if scripts_dir.exists() and scripts_dir.is_dir():
|
|
26
31
|
# Add all files from scripts directory to force-include
|
|
@@ -32,8 +37,18 @@ class CustomBuildHook(BuildHookInterface):
|
|
|
32
37
|
# Target path inside the wheel package
|
|
33
38
|
target_path = f"python_package_folder/scripts/{script_file.name}"
|
|
34
39
|
|
|
40
|
+
print(f"[DEBUG] Adding {source_path} -> {target_path}", file=sys.stderr)
|
|
41
|
+
|
|
35
42
|
# Add to force-include (hatchling will handle this)
|
|
36
43
|
# We need to add it to build_data['force_include']
|
|
37
44
|
if "force_include" not in build_data:
|
|
38
45
|
build_data["force_include"] = {}
|
|
39
46
|
build_data["force_include"][str(source_path)] = target_path
|
|
47
|
+
|
|
48
|
+
print(f"[DEBUG] force_include now has {len(build_data.get('force_include', {}))} entries", file=sys.stderr)
|
|
49
|
+
else:
|
|
50
|
+
print(f"[DEBUG] Scripts directory not found at {scripts_dir}", file=sys.stderr)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# Export the hook class (hatchling might need this)
|
|
54
|
+
__all__ = ["CustomBuildHook"]
|
|
@@ -98,37 +98,68 @@ Alternatively, provide --version explicitly to skip automatic version resolution
|
|
|
98
98
|
else:
|
|
99
99
|
# Try to locate script in installed package using importlib.resources
|
|
100
100
|
script_path = None
|
|
101
|
+
diagnostic_info = []
|
|
102
|
+
|
|
103
|
+
# Try importlib.resources approach
|
|
101
104
|
try:
|
|
102
105
|
package = resources.files("python_package_folder")
|
|
103
106
|
script_resource = package / "scripts" / "get-next-version.cjs"
|
|
107
|
+
|
|
108
|
+
diagnostic_info.append(f"Checked importlib.resources: python_package_folder/scripts/get-next-version.cjs")
|
|
109
|
+
|
|
104
110
|
if script_resource.is_file():
|
|
105
111
|
# Try direct path conversion first (normal file system install)
|
|
106
112
|
try:
|
|
107
113
|
script_path_candidate = Path(str(script_resource))
|
|
108
114
|
if script_path_candidate.exists():
|
|
109
115
|
script_path = script_path_candidate
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
diagnostic_info.append(f"Found via direct path: {script_path}")
|
|
117
|
+
except (TypeError, ValueError) as e:
|
|
118
|
+
diagnostic_info.append(f"Direct path conversion failed: {e}")
|
|
112
119
|
|
|
113
120
|
# If direct path didn't work, try as_file() for zip/pex installs
|
|
114
121
|
if script_path is None:
|
|
115
122
|
try:
|
|
116
123
|
temp_script_context = resources.as_file(script_resource)
|
|
117
124
|
script_path = temp_script_context.__enter__()
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
diagnostic_info.append(f"Found via as_file() (temp): {script_path}")
|
|
126
|
+
except (TypeError, ValueError, OSError) as e:
|
|
127
|
+
diagnostic_info.append(f"as_file() extraction failed: {e}")
|
|
128
|
+
else:
|
|
129
|
+
# Try to list what's actually in the scripts directory
|
|
130
|
+
try:
|
|
131
|
+
scripts_dir = package / "scripts"
|
|
132
|
+
if scripts_dir.is_dir():
|
|
133
|
+
available_files = list(scripts_dir.iterdir())
|
|
134
|
+
diagnostic_info.append(f"Scripts directory exists. Available files: {[f.name for f in available_files]}")
|
|
135
|
+
else:
|
|
136
|
+
diagnostic_info.append("Scripts directory does not exist in package")
|
|
137
|
+
except Exception as e:
|
|
138
|
+
diagnostic_info.append(f"Could not list scripts directory: {e}")
|
|
139
|
+
except (ImportError, ModuleNotFoundError, TypeError, AttributeError, OSError) as e:
|
|
140
|
+
diagnostic_info.append(f"importlib.resources failed: {type(e).__name__}: {e}")
|
|
122
141
|
|
|
123
142
|
# Fallback: try relative to package directory
|
|
124
143
|
if script_path is None:
|
|
125
144
|
package_dir = Path(__file__).parent
|
|
126
145
|
fallback_script = package_dir / "scripts" / "get-next-version.cjs"
|
|
146
|
+
diagnostic_info.append(f"Checked fallback path: {fallback_script}")
|
|
127
147
|
if fallback_script.exists():
|
|
128
148
|
script_path = fallback_script
|
|
149
|
+
diagnostic_info.append(f"Found via fallback: {script_path}")
|
|
150
|
+
else:
|
|
151
|
+
diagnostic_info.append(f"Fallback path does not exist")
|
|
129
152
|
|
|
130
153
|
if not script_path:
|
|
131
154
|
error_msg = "Could not locate get-next-version.cjs script"
|
|
155
|
+
error_msg += "\n\nDiagnostic information:"
|
|
156
|
+
for info in diagnostic_info:
|
|
157
|
+
error_msg += f"\n - {info}"
|
|
158
|
+
error_msg += (
|
|
159
|
+
"\n\nThis usually means the script was not included in the installed package."
|
|
160
|
+
"\nPlease ensure you're using the latest version of python-package-folder."
|
|
161
|
+
"\nIf the issue persists, report this as a bug."
|
|
162
|
+
)
|
|
132
163
|
print(f"Error: {error_msg}", file=sys.stderr)
|
|
133
164
|
return None, error_msg
|
|
134
165
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-package-folder
|
|
3
|
-
Version: 4.1.
|
|
3
|
+
Version: 4.1.3
|
|
4
4
|
Summary: Python package to automatically package and build a folder, fetching all relevant dependencies.
|
|
5
5
|
Project-URL: Repository, https://github.com/alelom/python-package-folder
|
|
6
6
|
Author-email: Alessio Lombardi <work@alelom.com>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
python_package_folder/__init__.py,sha256=DQt-uldOEKfh0MUqCvKdeNKOnpuOvpb7blYvXMyO9Wc,719
|
|
2
2
|
python_package_folder/__main__.py,sha256=a-__-VLhYw-J7S7CsHdhtEvQr3RiAZxiYDvKhKTgMX4,291
|
|
3
|
-
python_package_folder/_hatch_build.py,sha256=
|
|
3
|
+
python_package_folder/_hatch_build.py,sha256=03UCz4RSGaLFPpksgZultQ2lskfgMCI-t9gg6rXKj_A,2500
|
|
4
4
|
python_package_folder/analyzer.py,sha256=cmTNUDCWBIh3XZ_mShlQVG1P9NN_oe3FUBTirVtYfTQ,16709
|
|
5
5
|
python_package_folder/finder.py,sha256=RPidZ7LKCFuQ_KgCFIZdHWPXsZIDor3M4C0hKeYW7EI,11799
|
|
6
6
|
python_package_folder/manager.py,sha256=Z9RPg0ZQ7jZhmEXfCzX9OrD_oiA5p2Pnm5Y9tgW3ObQ,55970
|
|
7
7
|
python_package_folder/publisher.py,sha256=TSjdOvxvnWLbJCnduTK_xZBRfvsrq9kpEH-sfebeWkU,13507
|
|
8
8
|
python_package_folder/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
python_package_folder/python_package_folder.py,sha256=
|
|
9
|
+
python_package_folder/python_package_folder.py,sha256=cwc-o96qG3drhdhiTNomdR3jVOABLSP8T8rgtTxxXNE,23854
|
|
10
10
|
python_package_folder/subfolder_build.py,sha256=oH_KKLJIMByUZCl8y3AyohUO6Om0OvsIQ7Xg1fkd3jE,38782
|
|
11
11
|
python_package_folder/types.py,sha256=3yeSRR5p_3PDKEAaehW_RJ7NwJHexOIeA08bGaT1iSY,2368
|
|
12
12
|
python_package_folder/utils.py,sha256=lIkWsFKeAYAJ9TDUM99T4pUBHJVbUvCdUgkWQN-LUho,3111
|
|
13
13
|
python_package_folder/version.py,sha256=kIDP6S9trEfs9gj7lBYGxrWm4RPssRla24UtlO9Jkh4,9111
|
|
14
|
-
python_package_folder-4.1.
|
|
15
|
-
python_package_folder-4.1.
|
|
16
|
-
python_package_folder-4.1.
|
|
17
|
-
python_package_folder-4.1.
|
|
18
|
-
python_package_folder-4.1.
|
|
14
|
+
python_package_folder-4.1.3.dist-info/METADATA,sha256=5B6fZHMnTazvMxVnV6O10Mr6IU_6MY7nSrqJmqj5yCs,37517
|
|
15
|
+
python_package_folder-4.1.3.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
16
|
+
python_package_folder-4.1.3.dist-info/entry_points.txt,sha256=ttu4wAhoYSHGhWQNercLz9IVTTpXxhVlRA9vSTvaLe0,91
|
|
17
|
+
python_package_folder-4.1.3.dist-info/licenses/LICENSE,sha256=vNgRJh8YiecqZoZld7TtwPI5I72HIymKD9g32fiJjCE,1073
|
|
18
|
+
python_package_folder-4.1.3.dist-info/RECORD,,
|
|
File without changes
|
{python_package_folder-4.1.1.dist-info → python_package_folder-4.1.3.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{python_package_folder-4.1.1.dist-info → python_package_folder-4.1.3.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|