crcutil 2.1.2__tar.gz → 2.2.1__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 (53) hide show
  1. {crcutil-2.1.2/src/crcutil.egg-info → crcutil-2.2.1}/PKG-INFO +25 -5
  2. {crcutil-2.1.2 → crcutil-2.2.1}/README.md +23 -4
  3. {crcutil-2.1.2 → crcutil-2.2.1}/git-hooks/pre-commit +1 -1
  4. {crcutil-2.1.2 → crcutil-2.2.1}/init.sh +2 -0
  5. {crcutil-2.1.2 → crcutil-2.2.1}/pyproject.toml +2 -1
  6. {crcutil-2.1.2 → crcutil-2.2.1}/requirements.txt +2 -1
  7. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/core/checksum_manager.py +1 -3
  8. crcutil-2.2.1/src/crcutil/core/keyboard_monitor_darwin.py +86 -0
  9. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/core/keyboard_monitor_factory.py +7 -0
  10. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/util/file_importer.py +3 -2
  11. {crcutil-2.1.2 → crcutil-2.2.1/src/crcutil.egg-info}/PKG-INFO +25 -5
  12. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil.egg-info/SOURCES.txt +1 -1
  13. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil.egg-info/requires.txt +3 -0
  14. crcutil-2.1.2/src/crcutil/util/__init__.py +0 -0
  15. {crcutil-2.1.2 → crcutil-2.2.1}/.github/workflows/python-publish.yml +0 -0
  16. {crcutil-2.1.2 → crcutil-2.2.1}/.gitignore +0 -0
  17. {crcutil-2.1.2 → crcutil-2.2.1}/LICENSE +0 -0
  18. {crcutil-2.1.2 → crcutil-2.2.1}/git-hooks/commit-msg +0 -0
  19. {crcutil-2.1.2 → crcutil-2.2.1}/ruff.toml +0 -0
  20. {crcutil-2.1.2 → crcutil-2.2.1}/setup.cfg +0 -0
  21. {crcutil-2.1.2 → crcutil-2.2.1/src/crcutil}/__init__.py +0 -0
  22. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/__main__.py +0 -0
  23. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/config/log_config.yaml +0 -0
  24. {crcutil-2.1.2/src/crcutil → crcutil-2.2.1/src/crcutil/core}/__init__.py +0 -0
  25. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/core/checksum.py +0 -0
  26. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/core/keyboard_monitor.py +0 -0
  27. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/core/keyboard_monitor_wayland.py +0 -0
  28. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/core/keyboard_monitor_windows.py +0 -0
  29. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/core/keyboard_monitor_x11.py +0 -0
  30. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/core/prompt.py +0 -0
  31. {crcutil-2.1.2/src/crcutil/core → crcutil-2.2.1/src/crcutil/dto}/__init__.py +0 -0
  32. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/dto/bootstrap_paths_dto.py +0 -0
  33. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/dto/checksum_dto.py +0 -0
  34. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/dto/crc_diff_report_dto.py +0 -0
  35. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/dto/user_instructions_dto.py +0 -0
  36. {crcutil-2.1.2/src/crcutil/dto → crcutil-2.2.1/src/crcutil/enums}/__init__.py +0 -0
  37. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/enums/user_request.py +0 -0
  38. {crcutil-2.1.2/src/crcutil/enums → crcutil-2.2.1/src/crcutil/exception}/__init__.py +0 -0
  39. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/exception/bootstrap_error.py +0 -0
  40. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/exception/corrupt_crc_error.py +0 -0
  41. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/exception/device_error.py +0 -0
  42. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/exception/unexpected_argument_error.py +0 -0
  43. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/exception/user_error.py +0 -0
  44. {crcutil-2.1.2/src/crcutil/exception → crcutil-2.2.1/src/crcutil/serializer}/__init__.py +0 -0
  45. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/serializer/checksum_serializer.py +0 -0
  46. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/serializer/crc_diff_report_serializer.py +0 -0
  47. {crcutil-2.1.2/src/crcutil/serializer → crcutil-2.2.1/src/crcutil/util}/__init__.py +0 -0
  48. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/util/crcutil_logger.py +0 -0
  49. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/util/path_ops.py +0 -0
  50. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil/util/static.py +0 -0
  51. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil.egg-info/dependency_links.txt +0 -0
  52. {crcutil-2.1.2 → crcutil-2.2.1}/src/crcutil.egg-info/entry_points.txt +0 -0
  53. {crcutil-2.1.2 → crcutil-2.2.1}/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.1.2
3
+ Version: 2.2.1
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,6 +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-Cocoa==12.1; sys_platform == "darwin"
44
45
  Dynamic: license-file
45
46
 
46
47
  # CRCUtil
@@ -53,11 +54,12 @@ Portable CRC32 Checksum Tool – Generate & Compare
53
54
  ![CLI](https://img.shields.io/badge/Interface-CLI-important)
54
55
 
55
56
  > [!NOTE]
56
- > Installation is supported only for the following:
57
+ > Installation is supported for the following:
57
58
  > - Windows (amd64)
58
59
  > - Linux (amd64)
59
60
  > - X11
60
61
  > - Wayland
62
+ > - MacOS (arm64)
61
63
 
62
64
 
63
65
  ## Table of Contents
@@ -67,6 +69,7 @@ Portable CRC32 Checksum Tool – Generate & Compare
67
69
  * [crc](#crc)
68
70
  * [diff](#diff)
69
71
  * [pause/resume](#pauseresume)
72
+ * [Logs](#logs)
70
73
  * [Development](#development)
71
74
 
72
75
  ## Installation
@@ -87,6 +90,15 @@ sudo usermod -aG input $USER
87
90
  sudo pkill -u $USER
88
91
  ```
89
92
 
93
+ ### MacOS
94
+ > [!NOTE]
95
+ > - Enable Accesibility Access for the Terminal on System Settings > Privacy & Security > Accessibility
96
+ > - This makes it possible in MacOS to track keyboard presses; necessary for the playback controls
97
+
98
+ ```bash
99
+ pip install crcutil
100
+ ```
101
+
90
102
  ## Usage
91
103
 
92
104
  ### crc
@@ -124,22 +136,30 @@ crcutil diff -l 'C:\crc1.json' 'C:\crc2.json' -o 'C:\diff.json'
124
136
  - p
125
137
  - Windows
126
138
  - Linux (X11)
139
+ - MacOS
127
140
  - alt+p
128
141
  - Linux (Wayland)
129
142
  - The tool can be exited at any time by pressing:
130
143
  - q
131
144
  - Windows
132
145
  - Linux (X11)
146
+ - MacOS
133
147
  - alt+q
134
148
  - Linux (Wayland)
135
149
 
150
+ ## Logs
151
+
152
+ > [!NOTE]
153
+ > Logs can be found in:
154
+ > - Windows -> C:\Users\User\Documents\crcutil\log
155
+ > - Linux -> $XDG_STATE_HOME/crcutil/log
156
+ > - MacOS -> /Library/Application Support/crcutil/log
157
+
136
158
  ## Development
137
159
 
138
160
  > [!NOTE]
139
- > Development requires a fully configured [Dotfiles](https://github.com/florez-carlos/dotfiles) dev environment <br>
161
+ > Only Ubuntu environments supported
140
162
 
141
163
  ```bash
142
164
  source init.sh
143
165
  ```
144
-
145
-
@@ -8,11 +8,12 @@ Portable CRC32 Checksum Tool – Generate & Compare
8
8
  ![CLI](https://img.shields.io/badge/Interface-CLI-important)
9
9
 
10
10
  > [!NOTE]
11
- > Installation is supported only for the following:
11
+ > Installation is supported for the following:
12
12
  > - Windows (amd64)
13
13
  > - Linux (amd64)
14
14
  > - X11
15
15
  > - Wayland
16
+ > - MacOS (arm64)
16
17
 
17
18
 
18
19
  ## Table of Contents
@@ -22,6 +23,7 @@ Portable CRC32 Checksum Tool – Generate & Compare
22
23
  * [crc](#crc)
23
24
  * [diff](#diff)
24
25
  * [pause/resume](#pauseresume)
26
+ * [Logs](#logs)
25
27
  * [Development](#development)
26
28
 
27
29
  ## Installation
@@ -42,6 +44,15 @@ sudo usermod -aG input $USER
42
44
  sudo pkill -u $USER
43
45
  ```
44
46
 
47
+ ### MacOS
48
+ > [!NOTE]
49
+ > - Enable Accesibility Access for the Terminal on System Settings > Privacy & Security > Accessibility
50
+ > - This makes it possible in MacOS to track keyboard presses; necessary for the playback controls
51
+
52
+ ```bash
53
+ pip install crcutil
54
+ ```
55
+
45
56
  ## Usage
46
57
 
47
58
  ### crc
@@ -79,22 +90,30 @@ crcutil diff -l 'C:\crc1.json' 'C:\crc2.json' -o 'C:\diff.json'
79
90
  - p
80
91
  - Windows
81
92
  - Linux (X11)
93
+ - MacOS
82
94
  - alt+p
83
95
  - Linux (Wayland)
84
96
  - The tool can be exited at any time by pressing:
85
97
  - q
86
98
  - Windows
87
99
  - Linux (X11)
100
+ - MacOS
88
101
  - alt+q
89
102
  - Linux (Wayland)
90
103
 
104
+ ## Logs
105
+
106
+ > [!NOTE]
107
+ > Logs can be found in:
108
+ > - Windows -> C:\Users\User\Documents\crcutil\log
109
+ > - Linux -> $XDG_STATE_HOME/crcutil/log
110
+ > - MacOS -> /Library/Application Support/crcutil/log
111
+
91
112
  ## Development
92
113
 
93
114
  > [!NOTE]
94
- > Development requires a fully configured [Dotfiles](https://github.com/florez-carlos/dotfiles) dev environment <br>
115
+ > Only Ubuntu environments supported
95
116
 
96
117
  ```bash
97
118
  source init.sh
98
119
  ```
99
-
100
-
@@ -1,4 +1,4 @@
1
1
  #!/bin/bash
2
- shellcheck source.init.sh
2
+ shellcheck init.sh
3
3
  ruff check --fix
4
4
  ruff format
@@ -1,7 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
3
  color_red=$(tput setaf 1)
4
+ # shellcheck disable=SC2034
4
5
  color_green=$(tput setaf 2)
6
+ # shellcheck disable=SC2034
5
7
  color_yellow=$(tput setaf 3)
6
8
  color_normal=$(tput sgr0)
7
9
  setopt aliases
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "crcutil"
7
- version = "2.1.2"
7
+ version = "2.2.1"
8
8
  requires-python = ">=3.11"
9
9
  authors = [
10
10
  {name = "Carlos Florez", email = "carlos@florez.co.uk"}
@@ -30,6 +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-Cocoa==12.1;sys_platform == 'darwin'",
33
34
  ]
34
35
 
35
36
  [project.scripts]
@@ -6,4 +6,5 @@ jsonschema==4.25.1
6
6
  colorlog==6.10.1
7
7
  pynput==1.8.1
8
8
  python-xlib==0.33
9
- evdev==1.9.2
9
+ evdev==1.9.2;sys_platform == 'linux'
10
+ pyobjc-framework-Cocoa==12.1;sys_platform == 'darwin'
@@ -182,9 +182,7 @@ class ChecksumManager:
182
182
  description = f"Playback controls disabled: {e}"
183
183
  CrcutilLogger.get_console_logger().warning(description)
184
184
 
185
- length = (
186
- total_count if total_count else len(str_relative_locations)
187
- )
185
+ length = total_count or len(str_relative_locations)
188
186
  with alive_bar(length, dual_line=True) as bar:
189
187
  if total_count:
190
188
  offset_count = total_count - len(str_relative_locations)
@@ -0,0 +1,86 @@
1
+ from __future__ import annotations
2
+
3
+ import platform
4
+
5
+ from pynput import keyboard
6
+
7
+ from crcutil.core.keyboard_monitor import KeyboardMonitor
8
+ from crcutil.util.crcutil_logger import CrcutilLogger
9
+
10
+
11
+ class KeyboardMonitorDarwin(KeyboardMonitor):
12
+ def __init__(self) -> None:
13
+ self.is_paused = False
14
+ self.is_quit = False
15
+ self.listener = None
16
+ self.pause_description = "\n*Press p to pause/resume"
17
+ self.quit_description = "*Press q to quit"
18
+
19
+ def start(self) -> None:
20
+ self.is_paused = False
21
+ self.is_quit = False
22
+ self.listener = keyboard.Listener(on_press=self.__on_press)
23
+ self.listener.start()
24
+
25
+ def stop(self) -> None:
26
+ self.is_paused = False
27
+ self.is_quit = True
28
+ if self.listener:
29
+ self.listener.stop()
30
+
31
+ def get_pause_message(self) -> str:
32
+ return self.pause_description
33
+
34
+ def get_quit_message(self) -> str:
35
+ return self.quit_description
36
+
37
+ def is_listen_quit(self) -> bool:
38
+ return self.is_quit
39
+
40
+ def is_listen_paused(self) -> bool:
41
+ return self.is_paused
42
+
43
+ def __on_press(self, key: keyboard.Key | keyboard.KeyCode | None) -> None:
44
+ try:
45
+ if self.is_terminal_focused():
46
+ if key == keyboard.KeyCode.from_char("p"):
47
+ self.is_paused = not self.is_paused
48
+ if key == keyboard.KeyCode.from_char("q"):
49
+ self.stop()
50
+ except AttributeError:
51
+ pass
52
+
53
+ def is_terminal_focused(self) -> bool:
54
+ try:
55
+ if platform.system() == "Darwin":
56
+ from AppKit import ( # noqa: PLC0415 # pyright: ignore[reportMissingImports]
57
+ NSWorkspace,
58
+ )
59
+
60
+ active_app = NSWorkspace.sharedWorkspace().activeApplication()
61
+ bundle_id: str = active_app.get(
62
+ "NSApplicationBundleIdentifier", ""
63
+ )
64
+ name: str = active_app.get("NSApplicationName", "")
65
+ return bundle_id.startswith(
66
+ (
67
+ "com.apple.Terminal",
68
+ "com.googlecode.iterm2",
69
+ "io.alacritty",
70
+ "net.kovidgoyal.kitty",
71
+ "com.mitchellh.ghostty",
72
+ )
73
+ ) or name.lower() in (
74
+ "terminal",
75
+ "iterm2",
76
+ "alacritty",
77
+ "kitty",
78
+ "ghostty",
79
+ "warp",
80
+ "hyper",
81
+ )
82
+ except Exception as e: # noqa: BLE001
83
+ message = f"Could not probe for window focus: {e!s}"
84
+ CrcutilLogger.get_logger().debug(message)
85
+ return False
86
+ return False
@@ -25,6 +25,13 @@ class KeyboardMonitorFactory(Static):
25
25
  )
26
26
 
27
27
  return KeyboardMonitorWindows()
28
+
29
+ elif system == "Darwin":
30
+ from crcutil.core.keyboard_monitor_darwin import ( # noqa:PLC0415
31
+ KeyboardMonitorDarwin,
32
+ )
33
+
34
+ return KeyboardMonitorDarwin()
28
35
  elif system == "Linux":
29
36
  session = os.getenv("XDG_SESSION_TYPE") or ""
30
37
 
@@ -9,7 +9,6 @@ if TYPE_CHECKING:
9
9
 
10
10
  import ctypes.wintypes
11
11
  import json
12
- import os
13
12
  import platform
14
13
  from datetime import UTC, datetime, timedelta
15
14
  from pathlib import Path
@@ -195,7 +194,9 @@ class FileImporter(Static):
195
194
  description = "Could not locate Documents folder"
196
195
  raise FileNotFoundError(description) # noqa: TRY301
197
196
  elif system == "Linux":
198
- home_folder = os.getenv("HOME") or ""
197
+ home_folder = Path.home() / ".local/state"
198
+ elif system == "Darwin":
199
+ home_folder = Path.home() / "Library/Application Support"
199
200
  else:
200
201
  description = f"Unsupported OS: {system}"
201
202
  raise OSError(description) # noqa: TRY301
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crcutil
3
- Version: 2.1.2
3
+ Version: 2.2.1
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,6 +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-Cocoa==12.1; sys_platform == "darwin"
44
45
  Dynamic: license-file
45
46
 
46
47
  # CRCUtil
@@ -53,11 +54,12 @@ Portable CRC32 Checksum Tool – Generate & Compare
53
54
  ![CLI](https://img.shields.io/badge/Interface-CLI-important)
54
55
 
55
56
  > [!NOTE]
56
- > Installation is supported only for the following:
57
+ > Installation is supported for the following:
57
58
  > - Windows (amd64)
58
59
  > - Linux (amd64)
59
60
  > - X11
60
61
  > - Wayland
62
+ > - MacOS (arm64)
61
63
 
62
64
 
63
65
  ## Table of Contents
@@ -67,6 +69,7 @@ Portable CRC32 Checksum Tool – Generate & Compare
67
69
  * [crc](#crc)
68
70
  * [diff](#diff)
69
71
  * [pause/resume](#pauseresume)
72
+ * [Logs](#logs)
70
73
  * [Development](#development)
71
74
 
72
75
  ## Installation
@@ -87,6 +90,15 @@ sudo usermod -aG input $USER
87
90
  sudo pkill -u $USER
88
91
  ```
89
92
 
93
+ ### MacOS
94
+ > [!NOTE]
95
+ > - Enable Accesibility Access for the Terminal on System Settings > Privacy & Security > Accessibility
96
+ > - This makes it possible in MacOS to track keyboard presses; necessary for the playback controls
97
+
98
+ ```bash
99
+ pip install crcutil
100
+ ```
101
+
90
102
  ## Usage
91
103
 
92
104
  ### crc
@@ -124,22 +136,30 @@ crcutil diff -l 'C:\crc1.json' 'C:\crc2.json' -o 'C:\diff.json'
124
136
  - p
125
137
  - Windows
126
138
  - Linux (X11)
139
+ - MacOS
127
140
  - alt+p
128
141
  - Linux (Wayland)
129
142
  - The tool can be exited at any time by pressing:
130
143
  - q
131
144
  - Windows
132
145
  - Linux (X11)
146
+ - MacOS
133
147
  - alt+q
134
148
  - Linux (Wayland)
135
149
 
150
+ ## Logs
151
+
152
+ > [!NOTE]
153
+ > Logs can be found in:
154
+ > - Windows -> C:\Users\User\Documents\crcutil\log
155
+ > - Linux -> $XDG_STATE_HOME/crcutil/log
156
+ > - MacOS -> /Library/Application Support/crcutil/log
157
+
136
158
  ## Development
137
159
 
138
160
  > [!NOTE]
139
- > Development requires a fully configured [Dotfiles](https://github.com/florez-carlos/dotfiles) dev environment <br>
161
+ > Only Ubuntu environments supported
140
162
 
141
163
  ```bash
142
164
  source init.sh
143
165
  ```
144
-
145
-
@@ -1,7 +1,6 @@
1
1
  .gitignore
2
2
  LICENSE
3
3
  README.md
4
- __init__.py
5
4
  init.sh
6
5
  pyproject.toml
7
6
  requirements.txt
@@ -22,6 +21,7 @@ src/crcutil/core/__init__.py
22
21
  src/crcutil/core/checksum.py
23
22
  src/crcutil/core/checksum_manager.py
24
23
  src/crcutil/core/keyboard_monitor.py
24
+ src/crcutil/core/keyboard_monitor_darwin.py
25
25
  src/crcutil/core/keyboard_monitor_factory.py
26
26
  src/crcutil/core/keyboard_monitor_wayland.py
27
27
  src/crcutil/core/keyboard_monitor_windows.py
@@ -6,6 +6,9 @@ colorlog==6.10.1
6
6
  pynput==1.8.1
7
7
  python-xlib==0.33
8
8
 
9
+ [:sys_platform == "darwin"]
10
+ pyobjc-framework-Cocoa==12.1
11
+
9
12
  [:sys_platform == "linux"]
10
13
  evdev==1.9.2
11
14
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes