dazzle-filekit 0.2.1__tar.gz → 0.2.2__tar.gz
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.
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/PKG-INFO +12 -3
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/README.md +11 -2
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/__init__.py +2 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/utils/__init__.py +4 -2
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/utils/compat.py +83 -2
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit.egg-info/PKG-INFO +12 -3
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/pyproject.toml +1 -1
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/LICENSE +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/operations.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/paths.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/platform/__init__.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/platform/unix.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/platform/windows.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/utils/disk.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/utils/logger.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/utils/validation.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit/verification.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit.egg-info/SOURCES.txt +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit.egg-info/dependency_links.txt +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit.egg-info/requires.txt +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/dazzle_filekit.egg-info/top_level.txt +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/setup.cfg +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/setup.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/tests/test_auto_naming.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/tests/test_compat.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/tests/test_disk.py +0 -0
- {dazzle_filekit-0.2.1 → dazzle_filekit-0.2.2}/tests/test_smoke.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dazzle-filekit
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Cross-platform file operations toolkit with path handling, verification, and metadata preservation
|
|
5
5
|
Author: Dustin
|
|
6
6
|
Author-email: Dustin Darcy <6962246+djdarcy@users.noreply.github.com>
|
|
@@ -94,7 +94,11 @@ pip install dazzle-filekit[dev]
|
|
|
94
94
|
### Cross-Platform Path Handling
|
|
95
95
|
|
|
96
96
|
```python
|
|
97
|
-
from dazzle_filekit import
|
|
97
|
+
from dazzle_filekit import (
|
|
98
|
+
normalize_cross_platform_path,
|
|
99
|
+
resolve_cross_platform_path,
|
|
100
|
+
path_exists_cross_platform,
|
|
101
|
+
)
|
|
98
102
|
|
|
99
103
|
# Convert Git Bash style paths to native format
|
|
100
104
|
# On Windows: /c/Users/foo -> C:\Users\foo
|
|
@@ -104,7 +108,11 @@ path = normalize_cross_platform_path("/c/Users/foo/file.txt")
|
|
|
104
108
|
# Also handles WSL paths: /mnt/c/Users/...
|
|
105
109
|
path = normalize_cross_platform_path("/mnt/c/Users/foo/file.txt")
|
|
106
110
|
|
|
107
|
-
#
|
|
111
|
+
# Resolve with probing: if the normalized path doesn't exist,
|
|
112
|
+
# tries alternate platform formats (WSL, MSYS, Windows)
|
|
113
|
+
path = resolve_cross_platform_path("/mnt/c/Users/foo/file.txt")
|
|
114
|
+
|
|
115
|
+
# Check if a cross-platform path exists (uses resolve internally)
|
|
108
116
|
if path_exists_cross_platform("/c/Users/foo/file.txt"):
|
|
109
117
|
print("File exists!")
|
|
110
118
|
```
|
|
@@ -185,6 +193,7 @@ is_valid = verify_file_hash("file.txt", expected_hash, algorithm="sha256")
|
|
|
185
193
|
### Cross-Platform Utilities
|
|
186
194
|
|
|
187
195
|
- `normalize_cross_platform_path(path)` - Normalize Git Bash/WSL/Windows paths to native format
|
|
196
|
+
- `resolve_cross_platform_path(path)` - Normalize and probe alternate platform formats if path not found
|
|
188
197
|
- `path_exists_cross_platform(path)` - Check path existence across formats
|
|
189
198
|
- `is_windows()` / `is_unix()` - Platform detection
|
|
190
199
|
|
|
@@ -53,7 +53,11 @@ pip install dazzle-filekit[dev]
|
|
|
53
53
|
### Cross-Platform Path Handling
|
|
54
54
|
|
|
55
55
|
```python
|
|
56
|
-
from dazzle_filekit import
|
|
56
|
+
from dazzle_filekit import (
|
|
57
|
+
normalize_cross_platform_path,
|
|
58
|
+
resolve_cross_platform_path,
|
|
59
|
+
path_exists_cross_platform,
|
|
60
|
+
)
|
|
57
61
|
|
|
58
62
|
# Convert Git Bash style paths to native format
|
|
59
63
|
# On Windows: /c/Users/foo -> C:\Users\foo
|
|
@@ -63,7 +67,11 @@ path = normalize_cross_platform_path("/c/Users/foo/file.txt")
|
|
|
63
67
|
# Also handles WSL paths: /mnt/c/Users/...
|
|
64
68
|
path = normalize_cross_platform_path("/mnt/c/Users/foo/file.txt")
|
|
65
69
|
|
|
66
|
-
#
|
|
70
|
+
# Resolve with probing: if the normalized path doesn't exist,
|
|
71
|
+
# tries alternate platform formats (WSL, MSYS, Windows)
|
|
72
|
+
path = resolve_cross_platform_path("/mnt/c/Users/foo/file.txt")
|
|
73
|
+
|
|
74
|
+
# Check if a cross-platform path exists (uses resolve internally)
|
|
67
75
|
if path_exists_cross_platform("/c/Users/foo/file.txt"):
|
|
68
76
|
print("File exists!")
|
|
69
77
|
```
|
|
@@ -144,6 +152,7 @@ is_valid = verify_file_hash("file.txt", expected_hash, algorithm="sha256")
|
|
|
144
152
|
### Cross-Platform Utilities
|
|
145
153
|
|
|
146
154
|
- `normalize_cross_platform_path(path)` - Normalize Git Bash/WSL/Windows paths to native format
|
|
155
|
+
- `resolve_cross_platform_path(path)` - Normalize and probe alternate platform formats if path not found
|
|
147
156
|
- `path_exists_cross_platform(path)` - Check path existence across formats
|
|
148
157
|
- `is_windows()` / `is_unix()` - Platform detection
|
|
149
158
|
|
|
@@ -40,6 +40,7 @@ from .paths import (
|
|
|
40
40
|
|
|
41
41
|
from .utils.compat import (
|
|
42
42
|
normalize_cross_platform_path,
|
|
43
|
+
resolve_cross_platform_path,
|
|
43
44
|
path_exists_cross_platform,
|
|
44
45
|
is_windows,
|
|
45
46
|
is_unix
|
|
@@ -160,6 +161,7 @@ __all__ = [
|
|
|
160
161
|
|
|
161
162
|
# Cross-platform path utilities
|
|
162
163
|
'normalize_cross_platform_path',
|
|
164
|
+
'resolve_cross_platform_path',
|
|
163
165
|
'path_exists_cross_platform',
|
|
164
166
|
'is_windows',
|
|
165
167
|
'is_unix',
|
|
@@ -15,7 +15,8 @@ from .compat import (
|
|
|
15
15
|
is_windows, is_unix, is_admin, is_root,
|
|
16
16
|
fix_path_separators, fix_path_case, get_system_encoding,
|
|
17
17
|
get_system_temp_dir, get_home_dir, get_app_data_dir,
|
|
18
|
-
normalize_cross_platform_path,
|
|
18
|
+
normalize_cross_platform_path, resolve_cross_platform_path,
|
|
19
|
+
path_exists_cross_platform
|
|
19
20
|
)
|
|
20
21
|
|
|
21
22
|
from .validation import (
|
|
@@ -40,7 +41,8 @@ __all__ = [
|
|
|
40
41
|
'is_windows', 'is_unix', 'is_admin', 'is_root',
|
|
41
42
|
'fix_path_separators', 'fix_path_case', 'get_system_encoding',
|
|
42
43
|
'get_system_temp_dir', 'get_home_dir', 'get_app_data_dir',
|
|
43
|
-
'normalize_cross_platform_path', '
|
|
44
|
+
'normalize_cross_platform_path', 'resolve_cross_platform_path',
|
|
45
|
+
'path_exists_cross_platform',
|
|
44
46
|
|
|
45
47
|
# Validation functions
|
|
46
48
|
'is_valid_path', 'is_safe_path', 'validate_path_chars',
|
|
@@ -248,6 +248,84 @@ def normalize_cross_platform_path(path: Union[str, Path]) -> Path:
|
|
|
248
248
|
return Path(path_str)
|
|
249
249
|
|
|
250
250
|
|
|
251
|
+
def resolve_cross_platform_path(path: Union[str, Path]) -> Path:
|
|
252
|
+
"""
|
|
253
|
+
Resolve a path by normalizing it and probing alternate platform formats.
|
|
254
|
+
|
|
255
|
+
First normalizes using normalize_cross_platform_path(). If the result
|
|
256
|
+
doesn't exist, tries alternate platform representations:
|
|
257
|
+
|
|
258
|
+
On Windows:
|
|
259
|
+
/mnt/c/Users/... -> C:\\Users\\... (WSL mount)
|
|
260
|
+
/c/Users/... -> C:\\Users\\... (MSYS/Git Bash)
|
|
261
|
+
.../mnt/c/Users/... -> C:\\Users\\... (MSYS-mangled WSL)
|
|
262
|
+
|
|
263
|
+
On Linux/macOS:
|
|
264
|
+
C:\\Users\\... -> /mnt/c/Users/... (WSL)
|
|
265
|
+
C:\\Users\\... -> /c/Users/... (MSYS)
|
|
266
|
+
|
|
267
|
+
Returns the first existing candidate, or the normalized form if none exist.
|
|
268
|
+
|
|
269
|
+
Args:
|
|
270
|
+
path: Path string in any supported format
|
|
271
|
+
|
|
272
|
+
Returns:
|
|
273
|
+
Path object for the best match found
|
|
274
|
+
|
|
275
|
+
Examples:
|
|
276
|
+
# On Windows, if C:\\Users\\foo\\file.txt exists:
|
|
277
|
+
resolve_cross_platform_path("/mnt/c/Users/foo/file.txt")
|
|
278
|
+
# -> Path("C:/Users/foo/file.txt")
|
|
279
|
+
"""
|
|
280
|
+
import re
|
|
281
|
+
|
|
282
|
+
normalized = normalize_cross_platform_path(path)
|
|
283
|
+
|
|
284
|
+
if normalized.exists():
|
|
285
|
+
return normalized
|
|
286
|
+
|
|
287
|
+
path_str = str(normalized)
|
|
288
|
+
|
|
289
|
+
if is_windows():
|
|
290
|
+
# Try WSL /mnt/c/ -> C:\ (in case normalization didn't catch it)
|
|
291
|
+
wsl_match = re.match(r'^/mnt/([a-zA-Z])(/.*)?$', str(path))
|
|
292
|
+
if wsl_match:
|
|
293
|
+
drive = wsl_match.group(1).upper()
|
|
294
|
+
rest = (wsl_match.group(2) or '').replace('/', '\\')
|
|
295
|
+
candidate = Path(f"{drive}:{rest}")
|
|
296
|
+
if candidate.exists():
|
|
297
|
+
return candidate
|
|
298
|
+
|
|
299
|
+
# Check for MSYS-mangled WSL paths
|
|
300
|
+
# Git Bash converts /mnt/c/... to C:\Program Files\Git\mnt\c\...
|
|
301
|
+
mangled = re.search(r'[/\\]mnt[/\\]([a-zA-Z])[/\\](.*)', path_str)
|
|
302
|
+
if mangled:
|
|
303
|
+
drive = mangled.group(1).upper()
|
|
304
|
+
rest = mangled.group(2).replace('/', '\\')
|
|
305
|
+
candidate = Path(f"{drive}:\\{rest}")
|
|
306
|
+
if candidate.exists():
|
|
307
|
+
return candidate
|
|
308
|
+
|
|
309
|
+
else:
|
|
310
|
+
# On Linux/macOS: try Windows path -> WSL or MSYS format
|
|
311
|
+
win_match = re.match(r'^([a-zA-Z]):[/\\](.*)', path_str)
|
|
312
|
+
if win_match:
|
|
313
|
+
drive = win_match.group(1).lower()
|
|
314
|
+
rest = win_match.group(2).replace('\\', '/')
|
|
315
|
+
|
|
316
|
+
# Try WSL mount
|
|
317
|
+
candidate = Path(f"/mnt/{drive}/{rest}")
|
|
318
|
+
if candidate.exists():
|
|
319
|
+
return candidate
|
|
320
|
+
|
|
321
|
+
# Try MSYS/Git Bash style
|
|
322
|
+
candidate = Path(f"/{drive}/{rest}")
|
|
323
|
+
if candidate.exists():
|
|
324
|
+
return candidate
|
|
325
|
+
|
|
326
|
+
return normalized
|
|
327
|
+
|
|
328
|
+
|
|
251
329
|
def path_exists_cross_platform(path: Union[str, Path]) -> bool:
|
|
252
330
|
"""
|
|
253
331
|
Check if a path exists, handling cross-platform path formats.
|
|
@@ -255,6 +333,9 @@ def path_exists_cross_platform(path: Union[str, Path]) -> bool:
|
|
|
255
333
|
This is useful when receiving paths from external sources (like Claude Code)
|
|
256
334
|
that may be in a different format than the current platform expects.
|
|
257
335
|
|
|
336
|
+
Uses resolve_cross_platform_path() to try alternate platform formats
|
|
337
|
+
if the normalized path doesn't exist.
|
|
338
|
+
|
|
258
339
|
Args:
|
|
259
340
|
path: Path string in any supported format
|
|
260
341
|
|
|
@@ -262,8 +343,8 @@ def path_exists_cross_platform(path: Union[str, Path]) -> bool:
|
|
|
262
343
|
True if the path exists, False otherwise
|
|
263
344
|
"""
|
|
264
345
|
try:
|
|
265
|
-
|
|
266
|
-
return
|
|
346
|
+
resolved = resolve_cross_platform_path(path)
|
|
347
|
+
return resolved.exists()
|
|
267
348
|
except Exception:
|
|
268
349
|
return False
|
|
269
350
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dazzle-filekit
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Cross-platform file operations toolkit with path handling, verification, and metadata preservation
|
|
5
5
|
Author: Dustin
|
|
6
6
|
Author-email: Dustin Darcy <6962246+djdarcy@users.noreply.github.com>
|
|
@@ -94,7 +94,11 @@ pip install dazzle-filekit[dev]
|
|
|
94
94
|
### Cross-Platform Path Handling
|
|
95
95
|
|
|
96
96
|
```python
|
|
97
|
-
from dazzle_filekit import
|
|
97
|
+
from dazzle_filekit import (
|
|
98
|
+
normalize_cross_platform_path,
|
|
99
|
+
resolve_cross_platform_path,
|
|
100
|
+
path_exists_cross_platform,
|
|
101
|
+
)
|
|
98
102
|
|
|
99
103
|
# Convert Git Bash style paths to native format
|
|
100
104
|
# On Windows: /c/Users/foo -> C:\Users\foo
|
|
@@ -104,7 +108,11 @@ path = normalize_cross_platform_path("/c/Users/foo/file.txt")
|
|
|
104
108
|
# Also handles WSL paths: /mnt/c/Users/...
|
|
105
109
|
path = normalize_cross_platform_path("/mnt/c/Users/foo/file.txt")
|
|
106
110
|
|
|
107
|
-
#
|
|
111
|
+
# Resolve with probing: if the normalized path doesn't exist,
|
|
112
|
+
# tries alternate platform formats (WSL, MSYS, Windows)
|
|
113
|
+
path = resolve_cross_platform_path("/mnt/c/Users/foo/file.txt")
|
|
114
|
+
|
|
115
|
+
# Check if a cross-platform path exists (uses resolve internally)
|
|
108
116
|
if path_exists_cross_platform("/c/Users/foo/file.txt"):
|
|
109
117
|
print("File exists!")
|
|
110
118
|
```
|
|
@@ -185,6 +193,7 @@ is_valid = verify_file_hash("file.txt", expected_hash, algorithm="sha256")
|
|
|
185
193
|
### Cross-Platform Utilities
|
|
186
194
|
|
|
187
195
|
- `normalize_cross_platform_path(path)` - Normalize Git Bash/WSL/Windows paths to native format
|
|
196
|
+
- `resolve_cross_platform_path(path)` - Normalize and probe alternate platform formats if path not found
|
|
188
197
|
- `path_exists_cross_platform(path)` - Check path existence across formats
|
|
189
198
|
- `is_windows()` / `is_unix()` - Platform detection
|
|
190
199
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dazzle-filekit"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.2"
|
|
8
8
|
description = "Cross-platform file operations toolkit with path handling, verification, and metadata preservation"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|