fancy-subprocess 2.2__tar.gz → 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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fancy-subprocess
3
- Version: 2.2
3
+ Version: 2.3
4
4
  Summary: subprocess.run() with formatted output, detailed error messages and retry capabilities
5
5
  Project-URL: Homepage, https://github.com/petamas/python-fancy-subprocess
6
6
  Project-URL: Bug Tracker, https://github.com/petamas/python-fancy-subprocess/issues
@@ -18,7 +18,7 @@ Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
20
  Requires-Python: >=3.10
21
- Requires-Dist: ntstatus<2,>=1.1
21
+ Requires-Dist: ntstatus<3,>=2.0
22
22
  Requires-Dist: oslex<2,>=0.1.3
23
23
  Requires-Dist: pathext<2,>=1.5
24
24
  Requires-Dist: typeguard<5,>=4.4.2
@@ -40,7 +40,7 @@ Key differences compared to `subprocess.run()`:
40
40
  - The output of the command is always captured, but it is also immediately printed using `print_output`.
41
41
  - The exit code of the command is checked, and an exception is raised on failure, like `subprocess.run(check=True)`, but the list of exit codes treated as success is customizable, and the raised exception is `RunError` instead of `CalledProcessError`.
42
42
  - `OSError` is never raised, it gets converted to `RunError`.
43
- - `RunResult` is returned instead of `CompletedProcess` on success.
43
+ - `RunResult` is returned instead of `CompletedProcess` on success.
44
44
 
45
45
  Arguments (all of them except `cmd` are optional):
46
46
  - `cmd: Sequence[str | Path]` - Command to run. See `subprocess.run()`'s documentation for the interpretation of `cmd[0]`. It is recommended to use `fancy_subprocess.which()` to produce `cmd[0]`.
@@ -224,7 +224,7 @@ except fancy_subprocess.RunError as e:
224
224
  print(e)
225
225
  ```
226
226
 
227
- Running the script on Windows will produce the following output (-1072103376 is the signed integer interpretation of 0xC0190030, i.e. `STATUS_LOG_CORRUPTION_DETECTED`):
227
+ Running the script on Windows will produce the following output (-1072103376 is the signed integer interpretation of 0xC0190030, i.e. `STATUS_LOG_CORRUPTION_DETECTED`):
228
228
 
229
229
  ```
230
230
  Demonstrating failure...
@@ -13,7 +13,7 @@ Key differences compared to `subprocess.run()`:
13
13
  - The output of the command is always captured, but it is also immediately printed using `print_output`.
14
14
  - The exit code of the command is checked, and an exception is raised on failure, like `subprocess.run(check=True)`, but the list of exit codes treated as success is customizable, and the raised exception is `RunError` instead of `CalledProcessError`.
15
15
  - `OSError` is never raised, it gets converted to `RunError`.
16
- - `RunResult` is returned instead of `CompletedProcess` on success.
16
+ - `RunResult` is returned instead of `CompletedProcess` on success.
17
17
 
18
18
  Arguments (all of them except `cmd` are optional):
19
19
  - `cmd: Sequence[str | Path]` - Command to run. See `subprocess.run()`'s documentation for the interpretation of `cmd[0]`. It is recommended to use `fancy_subprocess.which()` to produce `cmd[0]`.
@@ -197,7 +197,7 @@ except fancy_subprocess.RunError as e:
197
197
  print(e)
198
198
  ```
199
199
 
200
- Running the script on Windows will produce the following output (-1072103376 is the signed integer interpretation of 0xC0190030, i.e. `STATUS_LOG_CORRUPTION_DETECTED`):
200
+ Running the script on Windows will produce the following output (-1072103376 is the signed integer interpretation of 0xC0190030, i.e. `STATUS_LOG_CORRUPTION_DETECTED`):
201
201
 
202
202
  ```
203
203
  Demonstrating failure...
@@ -113,7 +113,7 @@ def run(
113
113
  - The output of the command is always captured, but it is also immediately printed using `print_output`.
114
114
  - The exit code of the command is checked, and an exception is raised on failure, like `subprocess.run(check=True)`, but the list of exit codes treated as success is customizable, and the raised exception is `RunError` instead of `CalledProcessError`.
115
115
  - `OSError` is never raised, it gets converted to `RunError`.
116
- - `RunResult` is returned instead of `CompletedProcess` on success.
116
+ - `RunResult` is returned instead of `CompletedProcess` on success.
117
117
 
118
118
  Arguments (all of them except `cmd` are optional):
119
119
  - `cmd: Sequence[str | Path]` - Command to run. See `subprocess.run()`'s documentation for the interpretation of `cmd[0]`. It is recommended to use `fancy_subprocess.which()` to produce `cmd[0]`.
@@ -28,19 +28,17 @@ def oslex_join(cmd: Sequence[str | Path]) -> str:
28
28
  def stringify_exit_code(exit_code: int) -> Optional[str]:
29
29
  if sys.platform=='win32':
30
30
  # Windows
31
- try:
32
- bits = ThirtyTwoBits(exit_code)
33
- except ValueError:
31
+ if not ThirtyTwoBits.check(exit_code):
34
32
  return None
35
33
 
36
34
  try:
37
- code = NtStatus(bits)
38
- if code.severity!=NtStatusSeverity.STATUS_SEVERITY_SUCCESS:
39
- return code.name
35
+ status = NtStatus.decode(exit_code)
36
+ if NtStatus.severity(status) != NtStatusSeverity.STATUS_SEVERITY_SUCCESS:
37
+ return status.name
40
38
  except ValueError:
41
39
  pass
42
40
 
43
- return f'0x{bits.unsigned_value:08X}'
41
+ return f'0x{ThirtyTwoBits(exit_code).unsigned_value:08X}'
44
42
  else:
45
43
  # POSIX
46
44
  if exit_code<0:
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "fancy-subprocess"
7
- version = "2.2"
7
+ version = "2.3"
8
8
  authors = [
9
9
  { name="Tamás PEREGI", email="petamas@gmail.com" },
10
10
  ]
@@ -26,7 +26,7 @@ classifiers = [
26
26
  license = "MIT"
27
27
  license-files = ["LICENSE"]
28
28
  dependencies = [
29
- "ntstatus>=1.1,<2",
29
+ "ntstatus>=2.0,<3",
30
30
  "oslex>=0.1.3,<2",
31
31
  "pathext>=1.5,<2",
32
32
  "typeguard>=4.4.2,<5",
@@ -16,7 +16,7 @@ dependencies = [
16
16
 
17
17
  [package.metadata]
18
18
  requires-dist = [
19
- { name = "ntstatus", specifier = ">=1.1,<2" },
19
+ { name = "ntstatus", specifier = ">=2.0,<3" },
20
20
  { name = "oslex", specifier = ">=0.1.3,<2" },
21
21
  { name = "pathext", specifier = ">=1.5,<2" },
22
22
  { name = "typeguard", specifier = ">=4.4.2,<5" },
@@ -43,11 +43,11 @@ wheels = [
43
43
 
44
44
  [[package]]
45
45
  name = "ntstatus"
46
- version = "1.1"
46
+ version = "2.0"
47
47
  source = { registry = "https://pypi.org/simple" }
48
- sdist = { url = "https://files.pythonhosted.org/packages/b5/99/41f6934b2dc1b02c6366b9b5d5211f3dc8eb08c9f9d8813e58fe4f09f9b4/ntstatus-1.1.tar.gz", hash = "sha256:542069b3d0d654a37b9e068caaf4d29c8e3f9c1a2a4991ed0ec8c7a858022ee2", size = 37824 }
48
+ sdist = { url = "https://files.pythonhosted.org/packages/d1/5d/e1caf3dc856bf17421707d43db640b25c51547a045966d08460feb4eab32/ntstatus-2.0.tar.gz", hash = "sha256:b5956961d3e723ed2e429b1817d74ab925ef9eea523089a5dbcc59e3185e7c3d", size = 263733 }
49
49
  wheels = [
50
- { url = "https://files.pythonhosted.org/packages/a5/cc/c9493a2a64dd9cfa8edf554028571f29398cb6fc693e6f4919f762994768/ntstatus-1.1-py3-none-any.whl", hash = "sha256:303239b3286fc0529fc8fd2daad6465ab7f5b2e0bc6abfdf785d48fbab1f2a54", size = 36674 },
50
+ { url = "https://files.pythonhosted.org/packages/18/39/b9608ead33d92d4ec7f8148744160c736efe625d18ff5f8d72068e79e93d/ntstatus-2.0-py3-none-any.whl", hash = "sha256:df4cecb8f6a4052ea01871f36c5445fb2e945e6ceee72c6369c1669e06de47d1", size = 260611 },
51
51
  ]
52
52
 
53
53
  [[package]]
File without changes