dekshell 0.2.0__tar.gz → 0.2.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.
- {dekshell-0.2.0 → dekshell-0.2.2}/PKG-INFO +2 -1
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/contexts/methods.py +28 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/contexts/properties.py +16 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/pyproject.toml +2 -1
- {dekshell-0.2.0 → dekshell-0.2.2}/README.md +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/__init__.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/click/__entry__.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/click/__init__.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/__init__.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/contexts/__init__.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/__init__.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/base/__init__.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/base/core.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/comment.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/define.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/echo.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/empty.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/env.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/exec.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/for_.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/function.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/if_.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/input.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/invoke.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/pip_.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/redirect.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/shell.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/timout.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/var.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/markers/while_.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/plugin/__init__.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/core/redirect.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/utils/__init__.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/utils/beep.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/utils/cmd.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/utils/pkg.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/utils/serializer.py +0 -0
- {dekshell-0.2.0 → dekshell-0.2.2}/dekshell/utils/shell.py +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dekshell
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Author-Email: sanzenwin <sanzenwin@gmail.com>
|
|
5
5
|
License: MIT
|
|
6
6
|
Requires-Python: >=3.8
|
|
7
7
|
Requires-Dist: packaging<=23.1
|
|
8
|
+
Requires-Dist: extra-platforms<=3.1.0
|
|
8
9
|
Requires-Dist: dektools[date,fetch,ps,tab]<1.0.0
|
|
9
10
|
Requires-Dist: dekmedia[audio]<1.0.0
|
|
10
11
|
Description-Content-Type: text/markdown
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import shutil
|
|
2
3
|
import sys
|
|
3
4
|
import tempfile
|
|
4
5
|
import getpass
|
|
@@ -17,10 +18,12 @@ from dektools.download import download_from_http
|
|
|
17
18
|
from dektools.ps.process import process_detail, process_kill, process_list_all
|
|
18
19
|
from dektools.time import now
|
|
19
20
|
from dektools.str import shlex_split, shlex_quote
|
|
21
|
+
from dektools.shell import shell_wrapper, is_user_admin
|
|
20
22
|
from ...utils.beep import sound_notify
|
|
21
23
|
from ..markers.base.core import MarkerBase, get_inner_vars
|
|
22
24
|
from ..markers.invoke import InvokeMarker, GotoMarker
|
|
23
25
|
from ..redirect import search_bin_by_path_tree
|
|
26
|
+
from .properties import current_os
|
|
24
27
|
|
|
25
28
|
|
|
26
29
|
def _is_true(x):
|
|
@@ -103,6 +106,26 @@ def _xeval(expression, default=_xeval_default, translate=False):
|
|
|
103
106
|
return default
|
|
104
107
|
|
|
105
108
|
|
|
109
|
+
def _install(name):
|
|
110
|
+
def posix(exe):
|
|
111
|
+
s = f"{exe} install -y {name}"
|
|
112
|
+
if is_user_admin():
|
|
113
|
+
s = 'sudo ' + command
|
|
114
|
+
return s
|
|
115
|
+
|
|
116
|
+
if shutil.which('apt-get'):
|
|
117
|
+
command = posix('apt-get')
|
|
118
|
+
elif shutil.which('yum'):
|
|
119
|
+
command = posix('yum')
|
|
120
|
+
elif shutil.which('brew'):
|
|
121
|
+
command = f"brew install {name}"
|
|
122
|
+
elif shutil.which('choco'):
|
|
123
|
+
command = f"choco install -y {name}"
|
|
124
|
+
else:
|
|
125
|
+
raise FileNotFoundError(f"Can't find a valid installer to install {name}")
|
|
126
|
+
shell_wrapper(command)
|
|
127
|
+
|
|
128
|
+
|
|
106
129
|
path_common_methods = {
|
|
107
130
|
'cd': os.chdir,
|
|
108
131
|
'cwd': lambda: os.getcwd(),
|
|
@@ -122,6 +145,7 @@ default_methods = {
|
|
|
122
145
|
'o2s': obj2str,
|
|
123
146
|
'now': now,
|
|
124
147
|
'getpass': getpass.getpass,
|
|
148
|
+
'install': _install,
|
|
125
149
|
'Path': Path,
|
|
126
150
|
'path': {
|
|
127
151
|
**path_common_methods,
|
|
@@ -165,6 +189,10 @@ default_methods = {
|
|
|
165
189
|
'pi': process_detail,
|
|
166
190
|
},
|
|
167
191
|
|
|
192
|
+
'sys': {
|
|
193
|
+
'utf8': lambda: sys.stdout.reconfigure(encoding='utf-8')
|
|
194
|
+
},
|
|
195
|
+
|
|
168
196
|
'compress': compress_files,
|
|
169
197
|
'decompress': decompress_files,
|
|
170
198
|
|
|
@@ -2,15 +2,21 @@ import os
|
|
|
2
2
|
import sys
|
|
3
3
|
import shutil
|
|
4
4
|
import tempfile
|
|
5
|
+
import sysconfig
|
|
6
|
+
import platform
|
|
5
7
|
from pathlib import Path
|
|
6
8
|
from sysconfig import get_paths
|
|
7
9
|
from importlib import metadata
|
|
10
|
+
from extra_platforms import current_os as extra_platforms_current_os
|
|
8
11
|
from dektools.module import ModuleProxy
|
|
9
12
|
from dektools.time import DateTime
|
|
13
|
+
from dektools.file import read_text
|
|
10
14
|
from ...utils.serializer import serializer
|
|
11
15
|
from ..redirect import shell_name
|
|
12
16
|
|
|
13
17
|
current_shell = shutil.which(shell_name, path=get_paths()['scripts'])
|
|
18
|
+
current_os = extra_platforms_current_os()
|
|
19
|
+
user_is_root = "posix" in os.name and os.geteuid() == 0
|
|
14
20
|
|
|
15
21
|
|
|
16
22
|
def make_shell_properties(shell):
|
|
@@ -54,6 +60,16 @@ default_properties = {
|
|
|
54
60
|
'win': is_on_win,
|
|
55
61
|
'ps': os.pathsep,
|
|
56
62
|
},
|
|
63
|
+
'platform': {
|
|
64
|
+
'cygwin': sys.platform == 'cygwin',
|
|
65
|
+
'mingw': sysconfig.get_platform() == 'mingw',
|
|
66
|
+
'msys': sys.platform == 'msys',
|
|
67
|
+
'wsl': 'Microsoft' in read_text('/proc/version', default=''),
|
|
68
|
+
'win': platform.system() == 'Windows',
|
|
69
|
+
'mac': platform.system() == 'Darwin',
|
|
70
|
+
'linux': platform.system() == 'Linux',
|
|
71
|
+
'x': current_os,
|
|
72
|
+
},
|
|
57
73
|
'path': {
|
|
58
74
|
'root': Path(path_root),
|
|
59
75
|
'home': Path(path_home),
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "dekshell"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.2"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "sanzenwin", email = "sanzenwin@gmail.com" },
|
|
7
7
|
]
|
|
8
8
|
dependencies = [
|
|
9
9
|
"packaging<=23.1",
|
|
10
|
+
"extra-platforms<=3.1.0",
|
|
10
11
|
"dektools[date,fetch,ps,tab]<1.0.0",
|
|
11
12
|
"dekmedia[audio]<1.0.0",
|
|
12
13
|
]
|
|
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
|
|
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
|