python-package-folder 1.1.0__py3-none-any.whl → 1.1.2__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/finder.py +15 -11
- python_package_folder/manager.py +6 -2
- {python_package_folder-1.1.0.dist-info → python_package_folder-1.1.2.dist-info}/METADATA +1 -1
- {python_package_folder-1.1.0.dist-info → python_package_folder-1.1.2.dist-info}/RECORD +7 -7
- {python_package_folder-1.1.0.dist-info → python_package_folder-1.1.2.dist-info}/WHEEL +0 -0
- {python_package_folder-1.1.0.dist-info → python_package_folder-1.1.2.dist-info}/entry_points.txt +0 -0
- {python_package_folder-1.1.0.dist-info → python_package_folder-1.1.2.dist-info}/licenses/LICENSE +0 -0
python_package_folder/finder.py
CHANGED
|
@@ -74,23 +74,25 @@ class ExternalDependencyFinder:
|
|
|
74
74
|
if self._should_exclude_path(source_path):
|
|
75
75
|
continue
|
|
76
76
|
|
|
77
|
-
# For files,
|
|
78
|
-
#
|
|
79
|
-
# 1. It's a package (has __init__.py), OR
|
|
80
|
-
# 2. Files from it are actually imported (which is the case here since source_path is a file)
|
|
77
|
+
# For files, only copy parent directory if it's a package
|
|
78
|
+
# Otherwise, copy just the individual file
|
|
81
79
|
if source_path.is_file():
|
|
82
80
|
parent_dir = source_path.parent
|
|
83
81
|
module_parts = imp.module_name.split(".")
|
|
84
82
|
|
|
85
|
-
#
|
|
83
|
+
# Only copy parent directory if:
|
|
84
|
+
# 1. It's a package (has __init__.py), OR
|
|
85
|
+
# 2. Files from it are actually imported (which is the case here)
|
|
86
|
+
# But only copy the immediate parent, not entire directory trees
|
|
86
87
|
parent_is_package = (parent_dir / "__init__.py").exists()
|
|
87
|
-
|
|
88
|
-
files_in_parent_are_used = True # Since we're processing an import of a file from this parent
|
|
88
|
+
files_are_imported = True # Always true when processing an import
|
|
89
89
|
|
|
90
|
+
# Only copy immediate parent directory, not grandparent directories
|
|
91
|
+
# This prevents copying entire trees like models/Information_extraction
|
|
92
|
+
# when we only need models/Information_extraction/_shared_ie
|
|
90
93
|
should_copy_dir = (
|
|
91
94
|
not self._should_exclude_path(parent_dir)
|
|
92
|
-
and (parent_is_package or
|
|
93
|
-
and len(module_parts) > 2 # Has at least package.module structure
|
|
95
|
+
and (parent_is_package or files_are_imported) # Package OR files imported
|
|
94
96
|
and not parent_dir.is_relative_to(self.src_dir)
|
|
95
97
|
and not self.src_dir.is_relative_to(parent_dir)
|
|
96
98
|
and parent_dir != self.project_root
|
|
@@ -190,8 +192,10 @@ class ExternalDependencyFinder:
|
|
|
190
192
|
"""
|
|
191
193
|
# Check each component of the path
|
|
192
194
|
for part in path.parts:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
+
for pattern in self.exclude_patterns:
|
|
196
|
+
# Match if part equals pattern or starts with pattern
|
|
197
|
+
if part == pattern or part.startswith(pattern):
|
|
198
|
+
return True
|
|
195
199
|
return False
|
|
196
200
|
|
|
197
201
|
def _find_main_package(self) -> Path | None:
|
python_package_folder/manager.py
CHANGED
|
@@ -252,9 +252,13 @@ class BuildManager:
|
|
|
252
252
|
|
|
253
253
|
def should_exclude(path: Path) -> bool:
|
|
254
254
|
"""Check if a path should be excluded."""
|
|
255
|
+
# Check each component of the path
|
|
255
256
|
for part in path.parts:
|
|
256
|
-
if any
|
|
257
|
-
|
|
257
|
+
# Check if any part matches an exclusion pattern
|
|
258
|
+
for pattern in exclude_patterns:
|
|
259
|
+
# Match if part equals pattern or starts with pattern
|
|
260
|
+
if part == pattern or part.startswith(pattern):
|
|
261
|
+
return True
|
|
258
262
|
return False
|
|
259
263
|
|
|
260
264
|
# Create destination directory
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-package-folder
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
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,8 +1,8 @@
|
|
|
1
1
|
python_package_folder/__init__.py,sha256=DQt-uldOEKfh0MUqCvKdeNKOnpuOvpb7blYvXMyO9Wc,719
|
|
2
2
|
python_package_folder/__main__.py,sha256=a-__-VLhYw-J7S7CsHdhtEvQr3RiAZxiYDvKhKTgMX4,291
|
|
3
3
|
python_package_folder/analyzer.py,sha256=Iw5bdg9NahO57L3CZgGYbhU-m2mh0DpQQ-xqIINUfic,10976
|
|
4
|
-
python_package_folder/finder.py,sha256=
|
|
5
|
-
python_package_folder/manager.py,sha256=
|
|
4
|
+
python_package_folder/finder.py,sha256=JV12a3Tjc1jr8mtUtpr_b6pTA1PG1RzkXzSLIvhxMsI,9037
|
|
5
|
+
python_package_folder/manager.py,sha256=Kk38Rk7ScfEhlrKj-aCMVg74WrVAnUzJ3n14KQW1c-0,20405
|
|
6
6
|
python_package_folder/publisher.py,sha256=wP--QqO4qP9fT6g1ZY5r6UKw8zn9r0Uu0RFS3_zf_wc,11448
|
|
7
7
|
python_package_folder/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
python_package_folder/python_package_folder.py,sha256=lhY_bSS1cvC2d5fwKL61g58B0v4F0uXixp0BGelJ3b0,8733
|
|
@@ -10,8 +10,8 @@ python_package_folder/subfolder_build.py,sha256=D9ya3U4Qnms8VY2JDavG4FlxbpmSJvBs
|
|
|
10
10
|
python_package_folder/types.py,sha256=3yeSRR5p_3PDKEAaehW_RJ7NwJHexOIeA08bGaT1iSY,2368
|
|
11
11
|
python_package_folder/utils.py,sha256=JvW8zRPQaDMC0Gf54Jfm47grW1me_NuD_3QCEDtA0FM,2967
|
|
12
12
|
python_package_folder/version.py,sha256=AVMNpIybGgb5lA3HzRu90ytHc9l-dfqFQUqKQZY0nMw,9112
|
|
13
|
-
python_package_folder-1.1.
|
|
14
|
-
python_package_folder-1.1.
|
|
15
|
-
python_package_folder-1.1.
|
|
16
|
-
python_package_folder-1.1.
|
|
17
|
-
python_package_folder-1.1.
|
|
13
|
+
python_package_folder-1.1.2.dist-info/METADATA,sha256=TiuuQw7roGLxjDqDZu-va1NsZo999DF9VH2ja-wnq7s,28134
|
|
14
|
+
python_package_folder-1.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
15
|
+
python_package_folder-1.1.2.dist-info/entry_points.txt,sha256=ttu4wAhoYSHGhWQNercLz9IVTTpXxhVlRA9vSTvaLe0,91
|
|
16
|
+
python_package_folder-1.1.2.dist-info/licenses/LICENSE,sha256=vNgRJh8YiecqZoZld7TtwPI5I72HIymKD9g32fiJjCE,1073
|
|
17
|
+
python_package_folder-1.1.2.dist-info/RECORD,,
|
|
File without changes
|
{python_package_folder-1.1.0.dist-info → python_package_folder-1.1.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{python_package_folder-1.1.0.dist-info → python_package_folder-1.1.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|