plasmite 2.0.0__tar.gz → 2.0.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 (31) hide show
  1. {plasmite-2.0.0/plasmite.egg-info → plasmite-2.0.1}/PKG-INFO +1 -1
  2. {plasmite-2.0.0 → plasmite-2.0.1}/plasmite/_cli.py +25 -3
  3. {plasmite-2.0.0 → plasmite-2.0.1/plasmite.egg-info}/PKG-INFO +1 -1
  4. {plasmite-2.0.0 → plasmite-2.0.1}/pyproject.toml +1 -1
  5. {plasmite-2.0.0 → plasmite-2.0.1}/tests/test_cli.py +34 -4
  6. {plasmite-2.0.0 → plasmite-2.0.1}/LICENSE +0 -0
  7. {plasmite-2.0.0 → plasmite-2.0.1}/MANIFEST.in +0 -0
  8. {plasmite-2.0.0 → plasmite-2.0.1}/README.md +0 -0
  9. {plasmite-2.0.0 → plasmite-2.0.1}/THIRD_PARTY_NOTICES.md +0 -0
  10. {plasmite-2.0.0 → plasmite-2.0.1}/native/views.c +0 -0
  11. {plasmite-2.0.0 → plasmite-2.0.1}/plasmite/__init__.py +0 -0
  12. {plasmite-2.0.0 → plasmite-2.0.1}/plasmite/_include/plasmite.h +0 -0
  13. {plasmite-2.0.0 → plasmite-2.0.1}/plasmite/_views.py +0 -0
  14. {plasmite-2.0.0 → plasmite-2.0.1}/plasmite/_views_fallback.py +0 -0
  15. {plasmite-2.0.0 → plasmite-2.0.1}/plasmite/aio.py +0 -0
  16. {plasmite-2.0.0 → plasmite-2.0.1}/plasmite/py.typed +0 -0
  17. {plasmite-2.0.0 → plasmite-2.0.1}/plasmite.egg-info/SOURCES.txt +0 -0
  18. {plasmite-2.0.0 → plasmite-2.0.1}/plasmite.egg-info/dependency_links.txt +0 -0
  19. {plasmite-2.0.0 → plasmite-2.0.1}/plasmite.egg-info/entry_points.txt +0 -0
  20. {plasmite-2.0.0 → plasmite-2.0.1}/plasmite.egg-info/top_level.txt +0 -0
  21. {plasmite-2.0.0 → plasmite-2.0.1}/setup.cfg +0 -0
  22. {plasmite-2.0.0 → plasmite-2.0.1}/setup.py +0 -0
  23. {plasmite-2.0.0 → plasmite-2.0.1}/tests/test_append_views.py +0 -0
  24. {plasmite-2.0.0 → plasmite-2.0.1}/tests/test_asyncio_api.py +0 -0
  25. {plasmite-2.0.0 → plasmite-2.0.1}/tests/test_bindings.py +0 -0
  26. {plasmite-2.0.0 → plasmite-2.0.1}/tests/test_handle_callbacks.py +0 -0
  27. {plasmite-2.0.0 → plasmite-2.0.1}/tests/test_thread_safety.py +0 -0
  28. {plasmite-2.0.0 → plasmite-2.0.1}/tests/test_view_streams.py +0 -0
  29. {plasmite-2.0.0 → plasmite-2.0.1}/tests/test_views.py +0 -0
  30. {plasmite-2.0.0 → plasmite-2.0.1}/tests/test_wheel_platform.py +0 -0
  31. {plasmite-2.0.0 → plasmite-2.0.1}/wheel_platform.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plasmite
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: Persistent JSON message queues for Python - native bindings for local and remote IPC
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/sandover/plasmite
@@ -13,6 +13,7 @@ from __future__ import annotations
13
13
  import os
14
14
  from pathlib import Path
15
15
  import shutil
16
+ import signal
16
17
  import subprocess
17
18
  import sys
18
19
  import zipfile
@@ -79,10 +80,31 @@ def main() -> int:
79
80
  "and add its bin directory to PATH, or reinstall a wheel with bundled assets",
80
81
  file=sys.stderr,
81
82
  )
82
- return 1
83
+ return 3
83
84
  cli_path = str(discovered)
84
- completed = subprocess.run([cli_path, *sys.argv[1:]], check=False)
85
- return int(completed.returncode)
85
+ argv = [cli_path, *sys.argv[1:]]
86
+ try:
87
+ if os.name != "nt":
88
+ return os.execv(cli_path, argv)
89
+ # Windows delivers console events to the native child too. Wait for its
90
+ # exit status instead of turning Ctrl-C into a Python exception.
91
+ signals = (signal.SIGINT, signal.SIGBREAK)
92
+ previous = {event: signal.signal(event, lambda *_: None) for event in signals}
93
+ try:
94
+ status = subprocess.run(argv, check=False).returncode
95
+ # CPython passes sys.exit's value through a signed C long on
96
+ # Windows. Preserve the OS status bits, including Ctrl-C.
97
+ return status - 0x100000000 if status >= 0x80000000 else status
98
+ finally:
99
+ for event, handler in previous.items():
100
+ signal.signal(event, handler)
101
+ except OSError as error:
102
+ print(f"plasmite: could not start {cli_path}: {error.strerror}", file=sys.stderr)
103
+ if isinstance(error, FileNotFoundError):
104
+ return 3
105
+ if isinstance(error, PermissionError):
106
+ return 6
107
+ return 8
86
108
 
87
109
 
88
110
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plasmite
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: Persistent JSON message queues for Python - native bindings for local and remote IPC
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/sandover/plasmite
@@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
10
10
 
11
11
  [project]
12
12
  name = "plasmite"
13
- version = "2.0.0"
13
+ version = "2.0.1"
14
14
  description = "Persistent JSON message queues for Python - native bindings for local and remote IPC"
15
15
  readme = "README.md"
16
16
  requires-python = ">=3.10"
@@ -78,7 +78,7 @@ class ConsoleCliTests(unittest.TestCase):
78
78
  mock.patch.object(cli.sys, "argv", [str(first), "--version"]), \
79
79
  mock.patch.object(cli.sys, "stderr", stderr), \
80
80
  mock.patch.object(cli.subprocess, "run") as run:
81
- self.assertEqual(cli.main(), 1)
81
+ self.assertEqual(cli.main(), 3)
82
82
  run.assert_not_called()
83
83
  self.assertIn("install the Plasmite system SDK", stderr.getvalue())
84
84
 
@@ -116,7 +116,7 @@ class ConsoleCliTests(unittest.TestCase):
116
116
  mock.patch.object(cli.sys, "argv", [str(wrapper), "--version"]), \
117
117
  mock.patch.object(cli.sys, "stderr", stderr), \
118
118
  mock.patch.object(cli.subprocess, "run") as run:
119
- self.assertEqual(cli.main(), 1)
119
+ self.assertEqual(cli.main(), 3)
120
120
  run.assert_not_called()
121
121
  self.assertIn("install the Plasmite system SDK", stderr.getvalue())
122
122
  self.assertIn("PATH", stderr.getvalue())
@@ -127,10 +127,24 @@ class ConsoleCliTests(unittest.TestCase):
127
127
  with mock.patch.object(cli, "_bundled_cli_path", return_value=bundled), \
128
128
  mock.patch.object(cli, "_system_cli_path") as fallback, \
129
129
  mock.patch.object(cli.sys, "argv", args), \
130
+ mock.patch.object(cli.os, "execv", return_value=7) as replace, \
130
131
  mock.patch.object(cli.subprocess, "run", return_value=subprocess.CompletedProcess([], 7)) as run:
131
132
  self.assertEqual(cli.main(), 7)
132
133
  fallback.assert_not_called()
133
- run.assert_called_once_with([str(bundled), *args[1:]], check=False)
134
+ if os.name == "nt":
135
+ run.assert_called_once_with([str(bundled), *args[1:]], check=False)
136
+ replace.assert_not_called()
137
+ else:
138
+ replace.assert_called_once_with(str(bundled), [str(bundled), *args[1:]])
139
+ run.assert_not_called()
140
+
141
+ @unittest.skipUnless(os.name == "nt", "Windows process exit codes")
142
+ def test_windows_launcher_preserves_the_native_interrupt_status(self) -> None:
143
+ bundled = self.windows_executable("bundled")
144
+ status = 0xC000013A
145
+ with mock.patch.object(cli, "_bundled_cli_path", return_value=bundled), \
146
+ mock.patch.object(cli.subprocess, "run", return_value=subprocess.CompletedProcess([], status)):
147
+ self.assertEqual(cli.main(), -1073741510)
134
148
 
135
149
  def test_system_sdk_fallback_forwards_arguments(self) -> None:
136
150
  sdk = self.executable("sdk", b"\x7fELFnative-sdk")
@@ -138,9 +152,25 @@ class ConsoleCliTests(unittest.TestCase):
138
152
  with mock.patch.object(cli, "_bundled_cli_path", return_value=self.root / "missing"), \
139
153
  mock.patch.object(cli.os, "get_exec_path", return_value=[str(sdk.parent)]), \
140
154
  mock.patch.object(cli.sys, "argv", args), \
155
+ mock.patch.object(cli.os, "execv", return_value=0) as replace, \
141
156
  mock.patch.object(cli.subprocess, "run", return_value=subprocess.CompletedProcess([], 0)) as run:
142
157
  self.assertEqual(cli.main(), 0)
143
- run.assert_called_once_with([str(sdk.resolve()), *args[1:]], check=False)
158
+ if os.name == "nt":
159
+ run.assert_called_once_with([str(sdk.resolve()), *args[1:]], check=False)
160
+ else:
161
+ replace.assert_called_once_with(str(sdk.resolve()), [str(sdk.resolve()), *args[1:]])
162
+
163
+ def test_failed_launch_reports_permission_without_a_traceback(self) -> None:
164
+ bundled = self.executable("bundled", b"\x7fELFbundled")
165
+ stderr = io.StringIO()
166
+ denied = PermissionError(13, "Permission denied")
167
+ with mock.patch.object(cli, "_bundled_cli_path", return_value=bundled), \
168
+ mock.patch.object(cli.os, "execv", side_effect=denied), \
169
+ mock.patch.object(cli.subprocess, "run", side_effect=denied), \
170
+ mock.patch.object(cli.sys, "stderr", stderr):
171
+ self.assertEqual(cli.main(), 6)
172
+ self.assertIn("Permission denied", stderr.getvalue())
173
+ self.assertEqual(len(stderr.getvalue().splitlines()), 1)
144
174
 
145
175
 
146
176
  if __name__ == "__main__":
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