ryry-cli 2.87__tar.gz → 2.89__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.
- {ryry-cli-2.87/ryry_cli.egg-info → ryry-cli-2.89}/PKG-INFO +1 -1
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/constant.py +2 -2
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/ryry_server_socket.py +1 -1
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/ryry_webapi.py +6 -2
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/ryry_widget.py +36 -7
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/store.py +7 -7
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/task.py +5 -8
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/utils.py +1 -0
- {ryry-cli-2.87 → ryry-cli-2.89/ryry_cli.egg-info}/PKG-INFO +1 -1
- {ryry-cli-2.87 → ryry-cli-2.89}/setup.py +1 -1
- {ryry-cli-2.87 → ryry-cli-2.89}/LICENSE +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/README.md +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/__init__.py +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/main.py +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/ryry_service.py +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/script_template/__init__.py +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/script_template/main.py +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/script_template/run.py +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/server_func.py +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/taskUtils.py +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry/upload.py +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry_cli.egg-info/SOURCES.txt +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry_cli.egg-info/dependency_links.txt +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry_cli.egg-info/entry_points.txt +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry_cli.egg-info/requires.txt +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/ryry_cli.egg-info/top_level.txt +0 -0
- {ryry-cli-2.87 → ryry-cli-2.89}/setup.cfg +0 -0
|
@@ -23,10 +23,13 @@ def _domain_post(func, params, files={}, timeout=10, domain="api.dalipen.com"):
|
|
|
23
23
|
return 0, "", result_data.get("data", "")
|
|
24
24
|
else:
|
|
25
25
|
return result_data.get("code", -1), result_data.get("msg", "Unknown error"), ""
|
|
26
|
+
print(f"HTTP {res.status_code}: {res.text}")
|
|
26
27
|
return -99, f"HTTP {res.status_code}: {res.text}", ""
|
|
27
28
|
except requests.RequestException as e:
|
|
29
|
+
print(f"request {func} RequestException! {e}")
|
|
28
30
|
return -99, f"request {func} RequestException!", ""
|
|
29
31
|
except Exception as e:
|
|
32
|
+
print(f"request {func} Exception! {e}")
|
|
30
33
|
return -99, f"request {func} Exception!", ""
|
|
31
34
|
|
|
32
35
|
def _aigc_post(func, params, files={}, timeout=10):
|
|
@@ -264,7 +267,7 @@ def createTask(widget_name, params):
|
|
|
264
267
|
req = {
|
|
265
268
|
"widget_name": widget_name,
|
|
266
269
|
"widget_data": json.dumps(params),
|
|
267
|
-
"extend":
|
|
270
|
+
"extend": store.extend()
|
|
268
271
|
}
|
|
269
272
|
r1, r2, r3 = _aigc_post("aigc/task/createTask", req)
|
|
270
273
|
if r1 != 0:
|
|
@@ -300,7 +303,8 @@ def getAutoDeployWidget():
|
|
|
300
303
|
widget_name = it["name"]
|
|
301
304
|
version = it["version"]
|
|
302
305
|
package = it["package"]
|
|
303
|
-
|
|
306
|
+
is_install = it["is_install"]
|
|
307
|
+
result.append([widget_id, widget_name, version, package, is_install])
|
|
304
308
|
return result
|
|
305
309
|
|
|
306
310
|
def checkTask(checkUUID):
|
|
@@ -285,7 +285,7 @@ def widgetReInstall(name, url, local_path):
|
|
|
285
285
|
if pip_path:
|
|
286
286
|
return cmd
|
|
287
287
|
|
|
288
|
-
for version in range(12, 8, -1):
|
|
288
|
+
for version in range(12, 11, 10, 9, 8, 13, -1):
|
|
289
289
|
cmd = f"pip3.{version}"
|
|
290
290
|
pip_path = shutil.which(cmd)
|
|
291
291
|
if pip_path:
|
|
@@ -322,6 +322,30 @@ def widgetReInstall(name, url, local_path):
|
|
|
322
322
|
if os.path.exists(download_file):
|
|
323
323
|
os.remove(download_file)
|
|
324
324
|
|
|
325
|
+
def widgetUninstall(name, url):
|
|
326
|
+
def find_pip_command():
|
|
327
|
+
possible_pips = ['pip3.11', 'pip', 'pip3']
|
|
328
|
+
for cmd in possible_pips:
|
|
329
|
+
pip_path = shutil.which(cmd)
|
|
330
|
+
if pip_path:
|
|
331
|
+
return cmd
|
|
332
|
+
|
|
333
|
+
for version in range(12, 11, 10, 9, 8, 13, -1):
|
|
334
|
+
cmd = f"pip3.{version}"
|
|
335
|
+
pip_path = shutil.which(cmd)
|
|
336
|
+
if pip_path:
|
|
337
|
+
return cmd
|
|
338
|
+
|
|
339
|
+
raise RuntimeError("No pip command found on the system.")
|
|
340
|
+
if url.endswith(".whl"):
|
|
341
|
+
if name:
|
|
342
|
+
pip_cmd = find_pip_command()
|
|
343
|
+
subprocess.run(f"{pip_cmd} uninstall {name} -y", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
|
344
|
+
elif url.endswith(".zip"):
|
|
345
|
+
local_path = os.path.join(constant.base_path, "widget", name)
|
|
346
|
+
if os.path.exists(local_path):
|
|
347
|
+
shutil.rmtree(local_path)
|
|
348
|
+
|
|
325
349
|
def UpdateWidgetFromPypi():
|
|
326
350
|
_map = store.widgetMap()
|
|
327
351
|
for it in _map:
|
|
@@ -350,16 +374,21 @@ def UpdateWidgetFromPypi():
|
|
|
350
374
|
except Exception as ex:
|
|
351
375
|
print(ex)
|
|
352
376
|
continue
|
|
353
|
-
for widget_id, widget_name, remote_version, package_url in ryry_webapi.getAutoDeployWidget():
|
|
354
|
-
|
|
355
|
-
|
|
377
|
+
for widget_id, widget_name, remote_version, package_url, is_install in ryry_webapi.getAutoDeployWidget():
|
|
378
|
+
try:
|
|
379
|
+
if widget_id not in _map and is_install:
|
|
356
380
|
local_version, local_path = _local_package_info(widget_name)
|
|
357
381
|
widgetReInstall(widget_name, package_url, local_path)
|
|
358
382
|
widgetInstallNotify(widget_name, remote_version)
|
|
359
383
|
addWidgetToEnv(widget_name)
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
384
|
+
print(f"auto install {widget_name}")
|
|
385
|
+
elif is_install == False:
|
|
386
|
+
print(f"auto remove {widget_name}")
|
|
387
|
+
widgetUninstall(widget_name, package_url)
|
|
388
|
+
store.removeWidget(widget_id)
|
|
389
|
+
except Exception as ex:
|
|
390
|
+
print(ex)
|
|
391
|
+
continue
|
|
363
392
|
|
|
364
393
|
def installWidget(name):
|
|
365
394
|
widgetid, remote_version, package_url = ryry_webapi.findWidget(name)
|
|
@@ -129,15 +129,15 @@ def writeDeviceInfo(data):
|
|
|
129
129
|
sp.write(read_data)
|
|
130
130
|
extend()
|
|
131
131
|
|
|
132
|
-
GLOBAL_EXT_JSON = {}
|
|
132
|
+
GLOBAL_EXT_JSON = "{}"
|
|
133
133
|
def extend():
|
|
134
|
-
global GLOBAL_EXT_JSON
|
|
135
|
-
if len(GLOBAL_EXT_JSON
|
|
134
|
+
global GLOBAL_EXT_JSON
|
|
135
|
+
if len(GLOBAL_EXT_JSON) < 10:
|
|
136
136
|
sp = Store()
|
|
137
137
|
read_data = sp.read()
|
|
138
138
|
if "extend" in read_data:
|
|
139
|
-
GLOBAL_EXT_JSON = read_data["extend"]
|
|
140
|
-
if len(GLOBAL_EXT_JSON
|
|
139
|
+
GLOBAL_EXT_JSON = json.dumps(read_data["extend"])
|
|
140
|
+
if len(GLOBAL_EXT_JSON) < 10:
|
|
141
141
|
_genExtend()
|
|
142
142
|
else:
|
|
143
143
|
_genExtend()
|
|
@@ -157,7 +157,7 @@ def _genExtend():
|
|
|
157
157
|
extInfo["device_model"] = platform.machine()
|
|
158
158
|
|
|
159
159
|
try:
|
|
160
|
-
extInfo["ip_address"] = requests.get('https://api.ipify.org').text
|
|
160
|
+
extInfo["ip_address"] = requests.get('https://api.ipify.org', timeout=3).text
|
|
161
161
|
except Exception as e:
|
|
162
162
|
extInfo["ip_address"] = "unknown"
|
|
163
163
|
|
|
@@ -169,7 +169,7 @@ def _genExtend():
|
|
|
169
169
|
read_data["extend"] = extInfo
|
|
170
170
|
sp.write(read_data)
|
|
171
171
|
global GLOBAL_EXT_JSON
|
|
172
|
-
GLOBAL_EXT_JSON = extInfo
|
|
172
|
+
GLOBAL_EXT_JSON = json.dumps(extInfo)
|
|
173
173
|
|
|
174
174
|
def is_multithread():
|
|
175
175
|
return get_multithread() > 1
|
|
@@ -6,10 +6,7 @@ import signal
|
|
|
6
6
|
import subprocess, multiprocessing
|
|
7
7
|
from threading import Thread, current_thread, Lock
|
|
8
8
|
|
|
9
|
-
from ryry import ryry_webapi
|
|
10
|
-
from ryry import store
|
|
11
|
-
from ryry import taskUtils
|
|
12
|
-
from ryry import utils
|
|
9
|
+
from ryry import ryry_webapi,store,taskUtils,utils,constant
|
|
13
10
|
from pathlib import Path
|
|
14
11
|
|
|
15
12
|
def runTask(it, timeout):
|
|
@@ -60,12 +57,12 @@ def cmdWithWidgetName(name):
|
|
|
60
57
|
return None
|
|
61
58
|
|
|
62
59
|
def executeLocalPython(taskUUID, cmd, param, timeout=3600):
|
|
63
|
-
inputArgs = os.path.join(base_path, f"{taskUUID}.in")
|
|
60
|
+
inputArgs = os.path.join(constant.base_path, f"{taskUUID}.in")
|
|
64
61
|
if os.path.exists(inputArgs):
|
|
65
62
|
os.remove(inputArgs)
|
|
66
63
|
with open(inputArgs, 'w') as f:
|
|
67
64
|
json.dump(param, f)
|
|
68
|
-
outArgs = os.path.join(base_path, f"{taskUUID}.out")
|
|
65
|
+
outArgs = os.path.join(constant.base_path, f"{taskUUID}.out")
|
|
69
66
|
if os.path.exists(outArgs):
|
|
70
67
|
os.remove(outArgs)
|
|
71
68
|
|
|
@@ -103,8 +100,8 @@ def executeLocalPython(taskUUID, cmd, param, timeout=3600):
|
|
|
103
100
|
o2 = error.decode(encoding="utf8", errors="ignore")
|
|
104
101
|
error_msg = f"{o1}\n{o2}"
|
|
105
102
|
short_error_msg = ""
|
|
106
|
-
if len(error_msg) >
|
|
107
|
-
short_error_msg = f"{error_msg[0:
|
|
103
|
+
if len(error_msg) > 1010:
|
|
104
|
+
short_error_msg = f"{error_msg[0:500]}\n...\n{error_msg[len(error_msg)-500:]}"
|
|
108
105
|
else:
|
|
109
106
|
short_error_msg = error_msg
|
|
110
107
|
outData["message"] = short_error_msg
|
|
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
|