dais-shell 0.3.0__tar.gz → 0.3.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.
- {dais_shell-0.3.0 → dais_shell-0.3.2}/PKG-INFO +2 -1
- dais_shell-0.3.2/pyproject.toml +21 -0
- dais_shell-0.3.0/pyproject.toml → dais_shell-0.3.2/pyproject.toml.orig +6 -3
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/iostream_reader.py +12 -1
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/runtimes/PowershellRuntime.py +13 -5
- {dais_shell-0.3.0 → dais_shell-0.3.2}/README.md +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/__init__.py +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/constants.py +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/env_builder.py +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/py.typed +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/runtimes/BaseShellRuntime.py +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/runtimes/BashRuntime.py +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/runtimes/__init__.py +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/types/__init__.py +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/types/command_step.py +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/types/exceptions.py +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/types/shell_script.py +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/utils/__init__.py +0 -0
- {dais_shell-0.3.0 → dais_shell-0.3.2}/src/dais_shell/utils/env_expander.py +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dais-shell
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: The shell tool for Dais.
|
|
5
5
|
Author: BHznJNs
|
|
6
6
|
Author-email: BHznJNs <441768875@qq.com>
|
|
7
|
+
Requires-Dist: charset-normalizer>=3.5.1
|
|
7
8
|
Requires-Dist: psutil>=7.2.2
|
|
8
9
|
Requires-Python: >=3.11
|
|
9
10
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "dais-shell"
|
|
3
|
+
version = "0.3.2"
|
|
4
|
+
description = "The shell tool for Dais."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"charset-normalizer>=3.5.1",
|
|
9
|
+
"psutil>=7.2.2",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[[project.authors]]
|
|
13
|
+
name = "BHznJNs"
|
|
14
|
+
email = "441768875@qq.com"
|
|
15
|
+
|
|
16
|
+
[dependency-groups]
|
|
17
|
+
dev = ["pytest"]
|
|
18
|
+
|
|
19
|
+
[build-system]
|
|
20
|
+
requires = ["uv_build>=0.9.28,<0.13.0"]
|
|
21
|
+
build-backend = "uv_build"
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "dais-shell"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.2"
|
|
4
4
|
description = "The shell tool for Dais."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{ name = "BHznJNs", email = "441768875@qq.com" }]
|
|
7
7
|
requires-python = ">=3.11"
|
|
8
|
-
dependencies = [
|
|
8
|
+
dependencies = [
|
|
9
|
+
"charset-normalizer>=3.5.1",
|
|
10
|
+
"psutil>=7.2.2",
|
|
11
|
+
]
|
|
9
12
|
|
|
10
13
|
[dependency-groups]
|
|
11
14
|
dev = ["pytest"]
|
|
12
15
|
|
|
13
16
|
[build-system]
|
|
14
|
-
requires = ["uv_build>=0.9.28,<0.
|
|
17
|
+
requires = ["uv_build>=0.9.28,<0.13.0"]
|
|
15
18
|
build-backend = "uv_build"
|
|
@@ -4,6 +4,7 @@ from enum import Enum
|
|
|
4
4
|
from dataclasses import dataclass
|
|
5
5
|
from collections import deque
|
|
6
6
|
from typing import Callable
|
|
7
|
+
from charset_normalizer import from_bytes
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
IOStreamCallback = Callable[[str], None]
|
|
@@ -45,12 +46,22 @@ class IOStreamReader:
|
|
|
45
46
|
self._on_stdout = on_stdout
|
|
46
47
|
self._on_stderr = on_stderr
|
|
47
48
|
|
|
49
|
+
@staticmethod
|
|
50
|
+
def _decode(data: bytes) -> str:
|
|
51
|
+
try:
|
|
52
|
+
return data.decode("utf-8")
|
|
53
|
+
except UnicodeDecodeError:
|
|
54
|
+
result = from_bytes(data).best()
|
|
55
|
+
if result is None:
|
|
56
|
+
return data.decode("utf-8", errors="replace")
|
|
57
|
+
return result.output().decode("utf-8")
|
|
58
|
+
|
|
48
59
|
@staticmethod
|
|
49
60
|
async def _consumer(stream: asyncio.StreamReader, callback: IOStreamCallback | None, buf: IOStreamBuffer):
|
|
50
61
|
while not stream.at_eof():
|
|
51
62
|
line = await stream.readline()
|
|
52
63
|
if not line: break
|
|
53
|
-
text =
|
|
64
|
+
text = IOStreamReader._decode(line).rstrip("\r\n")
|
|
54
65
|
buf.append(text)
|
|
55
66
|
if callback: callback(text)
|
|
56
67
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import base64
|
|
3
|
-
import json
|
|
4
3
|
import shutil
|
|
5
4
|
import re
|
|
6
5
|
import xml.etree.ElementTree as ET
|
|
@@ -15,6 +14,17 @@ from ..types.shell_script import ShellScript
|
|
|
15
14
|
from ..types.exceptions import ShellRuntimeNotFoundError
|
|
16
15
|
|
|
17
16
|
|
|
17
|
+
POWERSHELL_PREFERENCES = """
|
|
18
|
+
$ErrorActionPreference = "Stop"
|
|
19
|
+
$WarningPreference = "SilentlyContinue"
|
|
20
|
+
$VerbosePreference = "SilentlyContinue"
|
|
21
|
+
$DebugPreference = "SilentlyContinue"
|
|
22
|
+
$InformationPreference = "SilentlyContinue"
|
|
23
|
+
$ProgressPreference = "SilentlyContinue"
|
|
24
|
+
|
|
25
|
+
$PSNativeCommandArgumentPassing = "Standard"
|
|
26
|
+
""".strip()
|
|
27
|
+
|
|
18
28
|
@dataclass
|
|
19
29
|
class PowerShellScript(ShellScript):
|
|
20
30
|
@classmethod
|
|
@@ -27,8 +37,7 @@ class PowerShellScript(ShellScript):
|
|
|
27
37
|
|
|
28
38
|
def to_wrapper_script(self):
|
|
29
39
|
return f"""
|
|
30
|
-
|
|
31
|
-
$PSNativeCommandArgumentPassing = "Standard"
|
|
40
|
+
{POWERSHELL_PREFERENCES}
|
|
32
41
|
|
|
33
42
|
chcp 65001 | Out-Null
|
|
34
43
|
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
@@ -61,8 +70,7 @@ class PowerShellCommandStep(CommandStep):
|
|
|
61
70
|
return "'" + s.replace("'", "''") + "'"
|
|
62
71
|
|
|
63
72
|
script = f"""
|
|
64
|
-
|
|
65
|
-
$PSNativeCommandArgumentPassing = "Standard"
|
|
73
|
+
{POWERSHELL_PREFERENCES}
|
|
66
74
|
|
|
67
75
|
chcp 65001 | Out-Null
|
|
68
76
|
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
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
|