shelltastic 0.8.2__tar.gz → 0.9.0__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.
- {shelltastic-0.8.2 → shelltastic-0.9.0}/PKG-INFO +1 -1
- shelltastic-0.9.0/pyproject.toml +59 -0
- shelltastic-0.8.2/pyproject.toml → shelltastic-0.9.0/pyproject.toml.orig +16 -12
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/backend/default/common.py +19 -15
- {shelltastic-0.8.2 → shelltastic-0.9.0}/LICENSE +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/README.md +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/__init__.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/backend/__init__.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/backend/base.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/backend/default/__init__.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/backend/default/local.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/backend/default/remote.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/display.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/enum.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/exception.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/frontend/__init__.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/frontend/common.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/frontend/git.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/frontend/scp.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/frontend/shell.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/host.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/io.py +0 -0
- {shelltastic-0.8.2 → shelltastic-0.9.0}/src/shelltastic/result.py +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "shelltastic"
|
|
3
|
+
version = "0.9.0"
|
|
4
|
+
description = "A fantastic shell command runner for python"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MPL-2.0"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.12"
|
|
9
|
+
dependencies = []
|
|
10
|
+
|
|
11
|
+
[[project.authors]]
|
|
12
|
+
name = "Bearmine"
|
|
13
|
+
|
|
14
|
+
[project.urls]
|
|
15
|
+
Repository = "https://forge.bearmine.com/bearmine/shelltastic"
|
|
16
|
+
|
|
17
|
+
[dependency-groups]
|
|
18
|
+
lint = ["ruff"]
|
|
19
|
+
test = [
|
|
20
|
+
"pytest",
|
|
21
|
+
"pytest-cov>=7.1.0",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[[dependency-groups.dev]]
|
|
25
|
+
include-group = "lint"
|
|
26
|
+
|
|
27
|
+
[[dependency-groups.dev]]
|
|
28
|
+
include-group = "test"
|
|
29
|
+
|
|
30
|
+
[build-system]
|
|
31
|
+
requires = ["uv_build>=0.11.18,<0.12.0"]
|
|
32
|
+
build-backend = "uv_build"
|
|
33
|
+
|
|
34
|
+
[tool.ruff.lint]
|
|
35
|
+
extend-select = [
|
|
36
|
+
"F",
|
|
37
|
+
"W",
|
|
38
|
+
"E",
|
|
39
|
+
"I",
|
|
40
|
+
"UP",
|
|
41
|
+
"C4",
|
|
42
|
+
"FA",
|
|
43
|
+
"ISC",
|
|
44
|
+
"ICN",
|
|
45
|
+
"RET",
|
|
46
|
+
"SIM",
|
|
47
|
+
"TID",
|
|
48
|
+
"TC",
|
|
49
|
+
"PTH",
|
|
50
|
+
"TD",
|
|
51
|
+
"NPY",
|
|
52
|
+
"FURB",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[tool.ruff.lint.pycodestyle]
|
|
56
|
+
max-line-length = 100
|
|
57
|
+
|
|
58
|
+
[tool.pytest.ini_options]
|
|
59
|
+
addopts = "--cov=shelltastic --cov-report html"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "shelltastic"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.9.0"
|
|
4
4
|
description = "A fantastic shell command runner for python"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -13,6 +13,19 @@ license-files = [
|
|
|
13
13
|
requires-python = ">=3.12"
|
|
14
14
|
dependencies = []
|
|
15
15
|
|
|
16
|
+
[dependency-groups]
|
|
17
|
+
dev = [
|
|
18
|
+
{include-group = "lint"},
|
|
19
|
+
{include-group = "test"},
|
|
20
|
+
]
|
|
21
|
+
lint = [
|
|
22
|
+
"ruff"
|
|
23
|
+
]
|
|
24
|
+
test = [
|
|
25
|
+
"pytest",
|
|
26
|
+
"pytest-cov>=7.1.0"
|
|
27
|
+
]
|
|
28
|
+
|
|
16
29
|
[project.urls]
|
|
17
30
|
Repository = "https://forge.bearmine.com/bearmine/shelltastic"
|
|
18
31
|
|
|
@@ -44,14 +57,5 @@ extend-select = [
|
|
|
44
57
|
[tool.ruff.lint.pycodestyle]
|
|
45
58
|
max-line-length = 100
|
|
46
59
|
|
|
47
|
-
[
|
|
48
|
-
|
|
49
|
-
{include-group = "lint"},
|
|
50
|
-
{include-group = "test"}
|
|
51
|
-
]
|
|
52
|
-
lint = [
|
|
53
|
-
"ruff"
|
|
54
|
-
]
|
|
55
|
-
test = [
|
|
56
|
-
"pytest"
|
|
57
|
-
]
|
|
60
|
+
[tool.pytest.ini_options]
|
|
61
|
+
addopts = "--cov=shelltastic --cov-report html"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import contextlib
|
|
1
2
|
import logging
|
|
2
3
|
import os
|
|
3
4
|
import shlex
|
|
@@ -233,32 +234,35 @@ class CommonShellAsyncResult(ShellResultAsync[RawIOBase | None, RawIOBase | None
|
|
|
233
234
|
return self._stderr
|
|
234
235
|
|
|
235
236
|
def __exit__(self, exc_type, exc, tb):
|
|
236
|
-
|
|
237
|
+
with contextlib.suppress(KeyboardInterrupt, subprocess.TimeoutExpired):
|
|
238
|
+
self.close()
|
|
237
239
|
|
|
238
|
-
def close(self) -> None:
|
|
240
|
+
def close(self, timeout: float | None = None) -> None:
|
|
239
241
|
if self._closed:
|
|
240
242
|
return
|
|
241
243
|
|
|
242
|
-
# Terminate popen
|
|
243
|
-
self._popen.terminate()
|
|
244
|
-
|
|
245
244
|
# Wait for command to finish before closing everything
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
self.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
245
|
+
try:
|
|
246
|
+
self._popen.wait(timeout)
|
|
247
|
+
except (KeyboardInterrupt, subprocess.TimeoutExpired):
|
|
248
|
+
# Kill the process and then reraise
|
|
249
|
+
self._popen.kill()
|
|
250
|
+
LOGGER.error("pid %s killed", self._popen.pid)
|
|
251
|
+
raise
|
|
252
|
+
finally:
|
|
253
|
+
# Close stdout and stderr
|
|
254
|
+
if self.stdout is not None:
|
|
255
|
+
self.stdout.close()
|
|
256
|
+
if self.stderr is not None:
|
|
257
|
+
self.stderr.close()
|
|
258
|
+
|
|
259
|
+
self._closed = True
|
|
255
260
|
|
|
256
261
|
def terminate(self) -> None:
|
|
257
262
|
if self._closed:
|
|
258
263
|
raise ShellClosedException(f"{self} is closed")
|
|
259
264
|
|
|
260
265
|
self._popen.terminate()
|
|
261
|
-
self.close()
|
|
262
266
|
|
|
263
267
|
def result(self) -> ShellResult[RawIOBase | None, RawIOBase | None]:
|
|
264
268
|
if self._closed:
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|