crcutil 2.2.0__tar.gz → 2.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.
Files changed (52) hide show
  1. {crcutil-2.2.0/src/crcutil.egg-info → crcutil-2.2.2}/PKG-INFO +10 -3
  2. {crcutil-2.2.0 → crcutil-2.2.2}/README.md +8 -1
  3. {crcutil-2.2.0 → crcutil-2.2.2}/pyproject.toml +2 -2
  4. {crcutil-2.2.0 → crcutil-2.2.2}/requirements.txt +1 -1
  5. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/core/checksum.py +5 -2
  6. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/core/keyboard_monitor_factory.py +35 -0
  7. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/util/path_ops.py +32 -1
  8. {crcutil-2.2.0 → crcutil-2.2.2/src/crcutil.egg-info}/PKG-INFO +10 -3
  9. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil.egg-info/requires.txt +1 -1
  10. {crcutil-2.2.0 → crcutil-2.2.2}/.github/workflows/python-publish.yml +0 -0
  11. {crcutil-2.2.0 → crcutil-2.2.2}/.gitignore +0 -0
  12. {crcutil-2.2.0 → crcutil-2.2.2}/LICENSE +0 -0
  13. {crcutil-2.2.0 → crcutil-2.2.2}/git-hooks/commit-msg +0 -0
  14. {crcutil-2.2.0 → crcutil-2.2.2}/git-hooks/pre-commit +0 -0
  15. {crcutil-2.2.0 → crcutil-2.2.2}/init.sh +0 -0
  16. {crcutil-2.2.0 → crcutil-2.2.2}/ruff.toml +0 -0
  17. {crcutil-2.2.0 → crcutil-2.2.2}/setup.cfg +0 -0
  18. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/__init__.py +0 -0
  19. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/__main__.py +0 -0
  20. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/config/log_config.yaml +0 -0
  21. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/core/__init__.py +0 -0
  22. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/core/checksum_manager.py +0 -0
  23. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/core/keyboard_monitor.py +0 -0
  24. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/core/keyboard_monitor_darwin.py +0 -0
  25. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/core/keyboard_monitor_wayland.py +0 -0
  26. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/core/keyboard_monitor_windows.py +0 -0
  27. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/core/keyboard_monitor_x11.py +0 -0
  28. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/core/prompt.py +0 -0
  29. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/dto/__init__.py +0 -0
  30. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/dto/bootstrap_paths_dto.py +0 -0
  31. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/dto/checksum_dto.py +0 -0
  32. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/dto/crc_diff_report_dto.py +0 -0
  33. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/dto/user_instructions_dto.py +0 -0
  34. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/enums/__init__.py +0 -0
  35. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/enums/user_request.py +0 -0
  36. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/exception/__init__.py +0 -0
  37. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/exception/bootstrap_error.py +0 -0
  38. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/exception/corrupt_crc_error.py +0 -0
  39. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/exception/device_error.py +0 -0
  40. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/exception/unexpected_argument_error.py +0 -0
  41. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/exception/user_error.py +0 -0
  42. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/serializer/__init__.py +0 -0
  43. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/serializer/checksum_serializer.py +0 -0
  44. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/serializer/crc_diff_report_serializer.py +0 -0
  45. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/util/__init__.py +0 -0
  46. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/util/crcutil_logger.py +0 -0
  47. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/util/file_importer.py +0 -0
  48. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil/util/static.py +0 -0
  49. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil.egg-info/SOURCES.txt +0 -0
  50. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil.egg-info/dependency_links.txt +0 -0
  51. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil.egg-info/entry_points.txt +0 -0
  52. {crcutil-2.2.0 → crcutil-2.2.2}/src/crcutil.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crcutil
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Author-email: Carlos Florez <carlos@florez.co.uk>
5
5
  Maintainer-email: Carlos Florez <carlos@florez.co.uk>
6
6
  License: MIT License
@@ -41,7 +41,7 @@ Requires-Dist: colorlog==6.10.1
41
41
  Requires-Dist: pynput==1.8.1
42
42
  Requires-Dist: python-xlib==0.33
43
43
  Requires-Dist: evdev==1.9.2; sys_platform == "linux"
44
- Requires-Dist: pyobjc-framework-AppKit==12.1; sys_platform == "darwin"
44
+ Requires-Dist: pyobjc-framework-Cocoa==12.1; sys_platform == "darwin"
45
45
  Dynamic: license-file
46
46
 
47
47
  # CRCUtil
@@ -71,6 +71,7 @@ Portable CRC32 Checksum Tool – Generate & Compare
71
71
  * [pause/resume](#pauseresume)
72
72
  * [Logs](#logs)
73
73
  * [Development](#development)
74
+ * [Known Issues](#known-issues)
74
75
 
75
76
  ## Installation
76
77
  > [!NOTE]
@@ -153,7 +154,7 @@ crcutil diff -l 'C:\crc1.json' 'C:\crc2.json' -o 'C:\diff.json'
153
154
  > Logs can be found in:
154
155
  > - Windows -> C:\Users\User\Documents\crcutil\log
155
156
  > - Linux -> $XDG_STATE_HOME/crcutil/log
156
- > - MacOS -> /Library/Application Support/crcutil/log
157
+ > - MacOS -> ~/Library/Application Support/crcutil/log
157
158
 
158
159
  ## Development
159
160
 
@@ -163,3 +164,9 @@ crcutil diff -l 'C:\crc1.json' 'C:\crc2.json' -o 'C:\diff.json'
163
164
  ```bash
164
165
  source init.sh
165
166
  ```
167
+
168
+ ## Known Issues
169
+
170
+ - Playback controls on remote graphical sessions (NX, VNC, RDP, etc...) are not currently supported.
171
+
172
+
@@ -25,6 +25,7 @@ Portable CRC32 Checksum Tool – Generate & Compare
25
25
  * [pause/resume](#pauseresume)
26
26
  * [Logs](#logs)
27
27
  * [Development](#development)
28
+ * [Known Issues](#known-issues)
28
29
 
29
30
  ## Installation
30
31
  > [!NOTE]
@@ -107,7 +108,7 @@ crcutil diff -l 'C:\crc1.json' 'C:\crc2.json' -o 'C:\diff.json'
107
108
  > Logs can be found in:
108
109
  > - Windows -> C:\Users\User\Documents\crcutil\log
109
110
  > - Linux -> $XDG_STATE_HOME/crcutil/log
110
- > - MacOS -> /Library/Application Support/crcutil/log
111
+ > - MacOS -> ~/Library/Application Support/crcutil/log
111
112
 
112
113
  ## Development
113
114
 
@@ -117,3 +118,9 @@ crcutil diff -l 'C:\crc1.json' 'C:\crc2.json' -o 'C:\diff.json'
117
118
  ```bash
118
119
  source init.sh
119
120
  ```
121
+
122
+ ## Known Issues
123
+
124
+ - Playback controls on remote graphical sessions (NX, VNC, RDP, etc...) are not currently supported.
125
+
126
+
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "crcutil"
7
- version = "2.2.0"
7
+ version = "2.2.2"
8
8
  requires-python = ">=3.11"
9
9
  authors = [
10
10
  {name = "Carlos Florez", email = "carlos@florez.co.uk"}
@@ -30,7 +30,7 @@ dependencies = [
30
30
  "pynput==1.8.1",
31
31
  "python-xlib==0.33",
32
32
  "evdev==1.9.2;sys_platform == 'linux'",
33
- "pyobjc-framework-AppKit==12.1;sys_platform == 'darwin'",
33
+ "pyobjc-framework-Cocoa==12.1;sys_platform == 'darwin'",
34
34
  ]
35
35
 
36
36
  [project.scripts]
@@ -7,4 +7,4 @@ colorlog==6.10.1
7
7
  pynput==1.8.1
8
8
  python-xlib==0.33
9
9
  evdev==1.9.2;sys_platform == 'linux'
10
- pyobjc-framework-AppKit==12.1;sys_platform == 'darwin'
10
+ pyobjc-framework-Cocoa==12.1;sys_platform == 'darwin'
@@ -181,6 +181,7 @@ class Checksum:
181
181
  sample = f.read(8192)
182
182
 
183
183
  # Empty file, treat as empty text
184
+ # Does not enter here if file not in text_extensions
184
185
  if not sample and extension in text_extensions:
185
186
  return True
186
187
 
@@ -199,5 +200,7 @@ class Checksum:
199
200
  if ascii_lower_range <= byte <= ascii_upper_range
200
201
  or byte in (tab, line_feed, carriage_return)
201
202
  )
202
- printable_character_treshold = 0.8
203
- return (printable_count / len(sample)) > printable_character_treshold
203
+ printable_character_threshold = 0.8
204
+ if printable_count <= 0:
205
+ return False
206
+ return (printable_count / len(sample)) > printable_character_threshold
@@ -27,15 +27,50 @@ class KeyboardMonitorFactory(Static):
27
27
  return KeyboardMonitorWindows()
28
28
 
29
29
  elif system == "Darwin":
30
+ import ctypes # noqa:PLC0415
31
+
32
+ app_services = ctypes.cdll.LoadLibrary(
33
+ "/System/Library/Frameworks/ApplicationServices.framework/ApplicationServices"
34
+ )
35
+ accesibility_access = app_services.AXIsProcessTrusted() == 1
36
+ if not accesibility_access:
37
+ description = (
38
+ "Terminal does not have accesibility access. "
39
+ "To enable playback controls on MacOS: "
40
+ "https://github.com/florez-carlos/"
41
+ "crcutil#macos"
42
+ )
43
+ raise DeviceError(description)
44
+
30
45
  from crcutil.core.keyboard_monitor_darwin import ( # noqa:PLC0415
31
46
  KeyboardMonitorDarwin,
32
47
  )
33
48
 
34
49
  return KeyboardMonitorDarwin()
35
50
  elif system == "Linux":
51
+ import getpass # noqa:PLC0415
52
+ import grp # noqa:PLC0415
53
+ import pwd # noqa:PLC0415
54
+
36
55
  session = os.getenv("XDG_SESSION_TYPE") or ""
37
56
 
38
57
  if session.startswith("wayland"):
58
+ username = getpass.getuser()
59
+ user = pwd.getpwnam(username)
60
+ groups = [
61
+ g.gr_name
62
+ for g in grp.getgrall()
63
+ if username in g.gr_mem or g.gr_gid == user.pw_gid
64
+ ]
65
+ if "input" not in groups:
66
+ description = (
67
+ "user not assigned to input group. "
68
+ "To enable playback controls on wayland: "
69
+ "https://github.com/florez-carlos/"
70
+ "crcutil#linux-wayland"
71
+ )
72
+ raise DeviceError(description)
73
+
39
74
  from crcutil.core.keyboard_monitor_wayland import ( # noqa:PLC0415
40
75
  KeyboardMonitorWayland,
41
76
  )
@@ -37,12 +37,18 @@ class PathOps(Static):
37
37
  )
38
38
  items = []
39
39
  try:
40
+ if path.is_symlink():
41
+ description = f"{PathOps.WARNING} Ignoring symlink: {path!s}"
42
+ if not supress_warnings:
43
+ CrcutilLogger.get_console_logger().warning(description)
44
+ return items
45
+
40
46
  if path.is_file():
41
47
  items.append(path)
42
48
  elif path.is_dir():
43
49
  items.append(path)
44
50
  for child in path.iterdir():
45
- sub_items = PathOps.walk(child)
51
+ sub_items = PathOps.walk(child, supress_warnings)
46
52
  items.extend(sub_items)
47
53
 
48
54
  except PermissionError:
@@ -61,6 +67,31 @@ class PathOps(Static):
61
67
  CrcutilLogger.get_console_logger().warning(description)
62
68
  debug = "POSIX permission denied"
63
69
  CrcutilLogger.get_logger().debug(debug)
70
+ elif e.errno == errno.ENAMETOOLONG:
71
+ parts = path.parts
72
+ truncated_path_str = ""
73
+
74
+ if len(parts) == 1:
75
+ truncated_path_str = "".join([parts[0]])
76
+ elif len(parts) == 2: # noqa: PLR2004
77
+ truncated_path_str = "".join([parts[0], parts[1]])
78
+ elif len(parts) == 3: # noqa: PLR2004
79
+ truncated_path_str = "".join(
80
+ [parts[0], parts[1], parts[2]]
81
+ )
82
+ elif len(parts) > 3: # noqa: PLR2004
83
+ truncated_path_str = "".join(
84
+ [parts[0], parts[1], "...", parts[-1]]
85
+ )
86
+ description = (
87
+ f"{PathOps.WARNING} Path too long to evaluate: "
88
+ f"{truncated_path_str}"
89
+ )
90
+ debug = f"Path too long to evaluate: {truncated_path_str}"
91
+ CrcutilLogger.get_logger().debug(debug)
92
+
93
+ if not supress_warnings:
94
+ CrcutilLogger.get_console_logger().warning(description)
64
95
  else:
65
96
  description = (
66
97
  f"{PathOps.WARNING} Unexpected error, "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crcutil
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Author-email: Carlos Florez <carlos@florez.co.uk>
5
5
  Maintainer-email: Carlos Florez <carlos@florez.co.uk>
6
6
  License: MIT License
@@ -41,7 +41,7 @@ Requires-Dist: colorlog==6.10.1
41
41
  Requires-Dist: pynput==1.8.1
42
42
  Requires-Dist: python-xlib==0.33
43
43
  Requires-Dist: evdev==1.9.2; sys_platform == "linux"
44
- Requires-Dist: pyobjc-framework-AppKit==12.1; sys_platform == "darwin"
44
+ Requires-Dist: pyobjc-framework-Cocoa==12.1; sys_platform == "darwin"
45
45
  Dynamic: license-file
46
46
 
47
47
  # CRCUtil
@@ -71,6 +71,7 @@ Portable CRC32 Checksum Tool – Generate & Compare
71
71
  * [pause/resume](#pauseresume)
72
72
  * [Logs](#logs)
73
73
  * [Development](#development)
74
+ * [Known Issues](#known-issues)
74
75
 
75
76
  ## Installation
76
77
  > [!NOTE]
@@ -153,7 +154,7 @@ crcutil diff -l 'C:\crc1.json' 'C:\crc2.json' -o 'C:\diff.json'
153
154
  > Logs can be found in:
154
155
  > - Windows -> C:\Users\User\Documents\crcutil\log
155
156
  > - Linux -> $XDG_STATE_HOME/crcutil/log
156
- > - MacOS -> /Library/Application Support/crcutil/log
157
+ > - MacOS -> ~/Library/Application Support/crcutil/log
157
158
 
158
159
  ## Development
159
160
 
@@ -163,3 +164,9 @@ crcutil diff -l 'C:\crc1.json' 'C:\crc2.json' -o 'C:\diff.json'
163
164
  ```bash
164
165
  source init.sh
165
166
  ```
167
+
168
+ ## Known Issues
169
+
170
+ - Playback controls on remote graphical sessions (NX, VNC, RDP, etc...) are not currently supported.
171
+
172
+
@@ -7,7 +7,7 @@ pynput==1.8.1
7
7
  python-xlib==0.33
8
8
 
9
9
  [:sys_platform == "darwin"]
10
- pyobjc-framework-AppKit==12.1
10
+ pyobjc-framework-Cocoa==12.1
11
11
 
12
12
  [:sys_platform == "linux"]
13
13
  evdev==1.9.2
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