dazzle-filekit 0.2.2__tar.gz → 0.2.3__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.
Files changed (27) hide show
  1. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/PKG-INFO +1 -1
  2. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/__init__.py +3 -1
  3. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/paths.py +64 -3
  4. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit.egg-info/PKG-INFO +1 -1
  5. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/pyproject.toml +1 -1
  6. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/setup.py +1 -1
  7. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/LICENSE +0 -0
  8. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/README.md +0 -0
  9. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/operations.py +0 -0
  10. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/platform/__init__.py +0 -0
  11. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/platform/unix.py +0 -0
  12. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/platform/windows.py +0 -0
  13. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/utils/__init__.py +0 -0
  14. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/utils/compat.py +0 -0
  15. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/utils/disk.py +0 -0
  16. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/utils/logger.py +0 -0
  17. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/utils/validation.py +0 -0
  18. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit/verification.py +0 -0
  19. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit.egg-info/SOURCES.txt +0 -0
  20. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit.egg-info/dependency_links.txt +0 -0
  21. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit.egg-info/requires.txt +0 -0
  22. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/dazzle_filekit.egg-info/top_level.txt +0 -0
  23. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/setup.cfg +0 -0
  24. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/tests/test_auto_naming.py +0 -0
  25. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/tests/test_compat.py +0 -0
  26. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/tests/test_disk.py +0 -0
  27. {dazzle_filekit-0.2.2 → dazzle_filekit-0.2.3}/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.2
3
+ Version: 0.2.3
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>
@@ -25,6 +25,7 @@ if not logger.handlers:
25
25
  # Import core functionality
26
26
  from .paths import (
27
27
  normalize_path,
28
+ normalize_path_no_resolve,
28
29
  is_same_file,
29
30
  split_drive_letter,
30
31
  is_unc_path,
@@ -79,7 +80,7 @@ from .verification import (
79
80
  verify_copied_files
80
81
  )
81
82
 
82
- __version__ = '0.2.1'
83
+ __version__ = '0.2.3'
83
84
 
84
85
  def configure_logging(level=logging.INFO, log_file=None):
85
86
  """
@@ -147,6 +148,7 @@ __all__ = [
147
148
 
148
149
  # Path functions
149
150
  'normalize_path',
151
+ 'normalize_path_no_resolve',
150
152
  'is_same_file',
151
153
  'split_drive_letter',
152
154
  'is_unc_path',
@@ -19,15 +19,18 @@ logger = logging.getLogger(__name__)
19
19
  def normalize_path(path: Union[str, Path]) -> Path:
20
20
  """
21
21
  Normalize a path to its canonical form.
22
-
22
+
23
+ This RESOLVES symlinks and junctions to their targets. Use
24
+ normalize_path_no_resolve() when you need the literal link path.
25
+
23
26
  Args:
24
27
  path: The path to normalize
25
-
28
+
26
29
  Returns:
27
30
  The normalized path as a Path object
28
31
  """
29
32
  path_obj = Path(path).expanduser()
30
-
33
+
31
34
  try:
32
35
  # Use resolve() to handle symlinks and relative paths
33
36
  return path_obj.resolve()
@@ -36,6 +39,64 @@ def normalize_path(path: Union[str, Path]) -> Path:
36
39
  return path_obj.absolute()
37
40
 
38
41
 
42
+ # MSYS-style path pattern: /c/ or /d/ etc.
43
+ _MSYS_DRIVE_RE = re.compile(r"^/([a-zA-Z])/")
44
+
45
+
46
+ def normalize_path_no_resolve(path: Union[str, Path]) -> Path:
47
+ """
48
+ Normalize a path WITHOUT resolving symlinks or junctions.
49
+
50
+ Use this instead of normalize_path() when you need the literal path to
51
+ a symlink, junction, or hardlink -- not the path it points to.
52
+
53
+ Handles:
54
+ /c/Users/foo -> C:\\Users\\foo (MSYS/Git Bash style)
55
+ c:/Users/foo -> C:\\Users\\foo (forward-slash Windows)
56
+ ~/foo -> C:\\Users\\Me\\foo (tilde expansion)
57
+ ./relative -> C:\\cwd\\relative (relative to cwd)
58
+ \\\\?\\C:\\... -> C:\\... (extended-length prefix)
59
+
60
+ Unlike normalize_path() and os.path.abspath(), this function does NOT
61
+ follow symlinks. On Windows, os.path.abspath() can resolve symlinks
62
+ and junctions, which destroys the distinction between a link and its
63
+ target. This function uses os.path.normpath() + manual cwd join instead.
64
+
65
+ Args:
66
+ path: The path to normalize
67
+
68
+ Returns:
69
+ The normalized path as a Path object
70
+ """
71
+ path_str = str(path).strip()
72
+
73
+ # Expand ~ first
74
+ path_str = os.path.expanduser(path_str)
75
+
76
+ # Convert MSYS /c/path -> C:/path (before any backslash conversion)
77
+ m = _MSYS_DRIVE_RE.match(path_str)
78
+ if m:
79
+ drive = m.group(1).upper()
80
+ path_str = drive + ":" + path_str[2:]
81
+
82
+ # Normalize slashes to OS native
83
+ path_str = path_str.replace("/", os.sep)
84
+
85
+ # Strip extended-length prefix \\?\ on Windows
86
+ if sys.platform == "win32" and path_str.startswith("\\\\?\\"):
87
+ path_str = path_str[4:]
88
+
89
+ # Normalize . and .. segments WITHOUT resolving symlinks
90
+ path_str = os.path.normpath(path_str)
91
+
92
+ # Make absolute without resolving links
93
+ # (os.path.abspath calls GetFullPathName on Windows which can resolve links)
94
+ if not os.path.isabs(path_str):
95
+ path_str = os.path.normpath(os.path.join(os.getcwd(), path_str))
96
+
97
+ return Path(path_str)
98
+
99
+
39
100
  def is_same_file(path1: Union[str, Path], path2: Union[str, Path]) -> bool:
40
101
  """
41
102
  Check if two paths refer to the same file or directory.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dazzle-filekit
3
- Version: 0.2.2
3
+ Version: 0.2.3
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>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dazzle-filekit"
7
- version = "0.2.2"
7
+ version = "0.2.3"
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"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="dazzle-filekit",
5
- version="0.2.0",
5
+ version="0.2.3",
6
6
  description="Cross-platform file operations toolkit with path handling, verification, and metadata preservation",
7
7
  author="Dustin",
8
8
  author_email="6962246+djdarcy@users.noreply.github.com",
File without changes
File without changes
File without changes