ryry-cli 1.8__tar.gz → 2.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.
- {ryry_cli-1.8/ryry_cli.egg-info → ryry_cli-2.1}/PKG-INFO +1 -1
- ryry_cli-2.1/ryry/constant.py +5 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/main.py +2 -5
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/ryry_webapi.py +5 -3
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/ryry_widget.py +31 -41
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/server_func.py +3 -3
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/utils.py +0 -60
- {ryry_cli-1.8 → ryry_cli-2.1/ryry_cli.egg-info}/PKG-INFO +1 -1
- {ryry_cli-1.8 → ryry_cli-2.1}/setup.py +2 -2
- ryry_cli-1.8/ryry/constant.py +0 -5
- {ryry_cli-1.8 → ryry_cli-2.1}/LICENSE +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/README.md +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/__init__.py +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/ryry_server_socket.py +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/ryry_service.py +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/script_template/__init__.py +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/script_template/main.py +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/script_template/run.py +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/store.py +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/task.py +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/taskUtils.py +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry/upload.py +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry_cli.egg-info/SOURCES.txt +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry_cli.egg-info/dependency_links.txt +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry_cli.egg-info/entry_points.txt +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry_cli.egg-info/requires.txt +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/ryry_cli.egg-info/top_level.txt +0 -0
- {ryry_cli-1.8 → ryry_cli-2.1}/setup.cfg +0 -0
|
@@ -271,8 +271,8 @@ def widget():
|
|
|
271
271
|
ryry_widget.enable(work_path)
|
|
272
272
|
elif command == 'disable':
|
|
273
273
|
ryry_widget.disable(work_path)
|
|
274
|
-
elif command == '
|
|
275
|
-
ryry_widget.
|
|
274
|
+
elif command == 'install':
|
|
275
|
+
ryry_widget.installWidget(work_path)
|
|
276
276
|
else:
|
|
277
277
|
print("Unknown command:", command)
|
|
278
278
|
|
|
@@ -287,9 +287,6 @@ def main():
|
|
|
287
287
|
service()
|
|
288
288
|
elif module == "status":
|
|
289
289
|
status()
|
|
290
|
-
elif module == "report":
|
|
291
|
-
utils.reportLog()
|
|
292
|
-
print(f"report success")
|
|
293
290
|
else:
|
|
294
291
|
print(f"Unknown command:{module}")
|
|
295
292
|
sys.exit(0)
|
|
@@ -229,13 +229,15 @@ def findWidget(name):
|
|
|
229
229
|
}
|
|
230
230
|
r1, r2, r3 = _aigc_post("aigc/task/findWidget", req)
|
|
231
231
|
if r1 != 0:
|
|
232
|
-
return
|
|
232
|
+
return "", "", ""
|
|
233
233
|
for it in r3:
|
|
234
234
|
widget_id = it["widget_id"]
|
|
235
235
|
widget_name = it["name"]
|
|
236
|
+
version = it["version"]
|
|
237
|
+
package = it["package"]
|
|
236
238
|
if widget_name.strip().lower() == name.strip().lower():
|
|
237
|
-
return widget_id
|
|
238
|
-
return
|
|
239
|
+
return widget_id, version, package
|
|
240
|
+
return "", "", ""
|
|
239
241
|
|
|
240
242
|
def checkTask(checkUUID):
|
|
241
243
|
req = {
|
|
@@ -85,20 +85,6 @@ def GetWidgetConfig(path):
|
|
|
85
85
|
return json.load(f)
|
|
86
86
|
return {}
|
|
87
87
|
|
|
88
|
-
def folderIsH5(path):
|
|
89
|
-
configFileExist = False
|
|
90
|
-
iconFileExist = False
|
|
91
|
-
htmlFileExist = False
|
|
92
|
-
for filename in os.listdir(path):
|
|
93
|
-
pathname = os.path.join(path, filename)
|
|
94
|
-
if (os.path.isfile(pathname)) and filename == "config.json":
|
|
95
|
-
configFileExist = True
|
|
96
|
-
if (os.path.isfile(pathname)) and filename == "icon.png":
|
|
97
|
-
iconFileExist = True
|
|
98
|
-
if (os.path.isfile(pathname)) and filename == "index.html":
|
|
99
|
-
htmlFileExist = True
|
|
100
|
-
return configFileExist and iconFileExist and htmlFileExist
|
|
101
|
-
|
|
102
88
|
def PathIsEmpty(path):
|
|
103
89
|
return len(os.listdir(path)) == 0
|
|
104
90
|
|
|
@@ -129,7 +115,7 @@ def setWidgetData(root, widgetid):
|
|
|
129
115
|
data = GetWidgetConfig(root)
|
|
130
116
|
data["widget_id"] = widgetid
|
|
131
117
|
data["name"] = "Demo"
|
|
132
|
-
data["version"] = "1
|
|
118
|
+
data["version"] = "2.1"
|
|
133
119
|
data["device_keys"] = [
|
|
134
120
|
utils.generate_unique_id()
|
|
135
121
|
]
|
|
@@ -173,7 +159,7 @@ def addWidgetToEnv(root, mute=False):
|
|
|
173
159
|
local_version = package.version
|
|
174
160
|
name = package.project_name
|
|
175
161
|
version = package.version
|
|
176
|
-
root = os.path.join(package.location,
|
|
162
|
+
root = os.path.join(package.location, name.replace("-", "_"))
|
|
177
163
|
except:
|
|
178
164
|
pass
|
|
179
165
|
|
|
@@ -222,21 +208,6 @@ def disable(args):
|
|
|
222
208
|
widget_id = data["widget_id"]
|
|
223
209
|
store.disableWidget(widget_id)
|
|
224
210
|
print(f"widget:{widget_id} updated")
|
|
225
|
-
|
|
226
|
-
def getTaskCount(args):
|
|
227
|
-
widget_id = args
|
|
228
|
-
if os.path.exists(args):
|
|
229
|
-
#find widgetid in args path
|
|
230
|
-
data = GetWidgetConfig(args)
|
|
231
|
-
if "widget_id" not in data:
|
|
232
|
-
print(f"path {args} is not widget folder!")
|
|
233
|
-
return
|
|
234
|
-
widget_id = data["widget_id"]
|
|
235
|
-
datas = ryry_webapi.GetTaskCount(widget_id)
|
|
236
|
-
for it in datas:
|
|
237
|
-
if it["widgetUUID"] == widget_id:
|
|
238
|
-
return it["taskCount"]
|
|
239
|
-
return -1
|
|
240
211
|
|
|
241
212
|
def publishWidget(package_folder):
|
|
242
213
|
if CheckWidgetDataInPath(package_folder) == False:
|
|
@@ -247,12 +218,6 @@ def publishWidget(package_folder):
|
|
|
247
218
|
name = data["name"]
|
|
248
219
|
local_version = data["version"]
|
|
249
220
|
user_id = utils.generate_unique_id()
|
|
250
|
-
|
|
251
|
-
#override setting
|
|
252
|
-
remote_version = _remote_package_version(name)
|
|
253
|
-
if compare_versions(remote_version, local_version) >= 0:
|
|
254
|
-
print(f"version {local_version} must be larger than {remote_version}, publish abandon")
|
|
255
|
-
return
|
|
256
221
|
|
|
257
222
|
#if in h5&script parent folder, add env path
|
|
258
223
|
if len(package_folder) > 0:
|
|
@@ -368,6 +333,17 @@ def widgetUpdateNotify(widgetName, oldver, newver):
|
|
|
368
333
|
"content": f"机器<{machine_name}[{device_id}]>[{ver}] widget:[{widgetName}]升级版本[{oldver}]->[{newver}]"
|
|
369
334
|
}
|
|
370
335
|
})
|
|
336
|
+
|
|
337
|
+
def widgetInstallNotify(widgetName, newver):
|
|
338
|
+
device_id = utils.generate_unique_id()
|
|
339
|
+
machine_name = socket.gethostname()
|
|
340
|
+
ver = get_distribution("ryry-cli").version
|
|
341
|
+
taskUtils.notifyWechatRobot({
|
|
342
|
+
"msgtype": "text",
|
|
343
|
+
"text": {
|
|
344
|
+
"content": f"机器<{machine_name}[{device_id}]>[{ver}] 安装widget:[{widgetName}][{newver}]"
|
|
345
|
+
}
|
|
346
|
+
})
|
|
371
347
|
|
|
372
348
|
def UpdateWidgetFromPypi():
|
|
373
349
|
map = store.widgetMap()
|
|
@@ -384,15 +360,29 @@ def UpdateWidgetFromPypi():
|
|
|
384
360
|
if "py_package" in data and len(data["py_package"]) > 0:
|
|
385
361
|
try:
|
|
386
362
|
py_package = data["py_package"]
|
|
387
|
-
remote_version =
|
|
363
|
+
widgetid, remote_version, package_url = ryry_webapi.findWidget(py_package)
|
|
388
364
|
local_version = _local_package_version(py_package)
|
|
389
365
|
if compare_versions(remote_version, local_version) > 0:
|
|
390
366
|
#update
|
|
391
|
-
subprocess.run(f"pip uninstall {py_package}", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
|
392
|
-
subprocess.run(f"pip install
|
|
367
|
+
subprocess.run(f"pip uninstall {py_package} -y", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
|
368
|
+
subprocess.run(f"pip install {package_url} -i https://pypi.python.org/simple/ --extra-index-url https://pypi.python.org/simple/",
|
|
393
369
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
|
394
370
|
widgetUpdateNotify(py_package, local_version, remote_version)
|
|
395
371
|
except Exception as ex:
|
|
396
372
|
print(ex)
|
|
397
373
|
continue
|
|
398
|
-
|
|
374
|
+
|
|
375
|
+
def installWidget(name):
|
|
376
|
+
widgetid, remote_version, package_url = ryry_webapi.findWidget(name)
|
|
377
|
+
if len(widgetid) <= 0:
|
|
378
|
+
print(f"{name} 不存在")
|
|
379
|
+
return
|
|
380
|
+
local_version = _local_package_version(name)
|
|
381
|
+
if compare_versions(remote_version, local_version) > 0:
|
|
382
|
+
#update
|
|
383
|
+
subprocess.run(f"pip uninstall {name} -y", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
|
384
|
+
subprocess.run(f"pip install {package_url} -i https://pypi.python.org/simple/ --extra-index-url https://pypi.python.org/simple/",
|
|
385
|
+
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
|
386
|
+
widgetInstallNotify(name, remote_version)
|
|
387
|
+
addWidgetToEnv(name)
|
|
388
|
+
|
|
@@ -23,12 +23,12 @@ class TaskThread(Thread):
|
|
|
23
23
|
self.checking = False
|
|
24
24
|
self.result = False, "Unknow"
|
|
25
25
|
if self.widgetid == None:
|
|
26
|
-
self.widgetid = ryry_webapi.findWidget(self.func)
|
|
26
|
+
self.widgetid, _, _ = ryry_webapi.findWidget(self.func)
|
|
27
27
|
if len(self.widgetid) > 0:
|
|
28
28
|
checkUUID = ryry_webapi.createTask(self.widgetid, self.params)
|
|
29
29
|
checking = True
|
|
30
30
|
checkCount = 0
|
|
31
|
-
while checking or checkCount >
|
|
31
|
+
while checking or checkCount > 600:
|
|
32
32
|
finish, success, data = ryry_webapi.checkTask(checkUUID)
|
|
33
33
|
if finish:
|
|
34
34
|
checking = False
|
|
@@ -36,7 +36,7 @@ class TaskThread(Thread):
|
|
|
36
36
|
self.call_back(self.idx, data)
|
|
37
37
|
return
|
|
38
38
|
checkCount += 1
|
|
39
|
-
time.sleep(
|
|
39
|
+
time.sleep(1)
|
|
40
40
|
else:
|
|
41
41
|
print(f"widget {self.func}-{self.widgetid} not found")
|
|
42
42
|
self.call_back(self.idx, None)
|
|
@@ -168,66 +168,6 @@ def deviceInfo():
|
|
|
168
168
|
data["gpu"]["list"].append(f"GPU0: Normal")
|
|
169
169
|
return data
|
|
170
170
|
|
|
171
|
-
def reportLog():
|
|
172
|
-
reason = ""
|
|
173
|
-
if len(sys.argv) >= 2:
|
|
174
|
-
reason = sys.argv[2].strip().replace("\n","").replace(",","").replace(" ","").replace(";","")
|
|
175
|
-
d = datetime.now().strftime('%Y_%m_%d_%H_%M_%S')
|
|
176
|
-
uid = generate_unique_id()
|
|
177
|
-
|
|
178
|
-
thisFileDir = os.path.dirname(os.path.abspath(__file__))
|
|
179
|
-
dist = os.path.join(thisFileDir, f"{uid}_{reason}_{d}.zip")
|
|
180
|
-
zip = zipfile.ZipFile(dist, "w", zipfile.ZIP_DEFLATED)
|
|
181
|
-
|
|
182
|
-
for root,dirs,files in os.walk(thisFileDir):
|
|
183
|
-
for file in files:
|
|
184
|
-
if str(file).startswith("~$"):
|
|
185
|
-
continue
|
|
186
|
-
ext = file[file.rindex("."):]
|
|
187
|
-
if ext == ".log" or ext == ".json" or ".log." in file:
|
|
188
|
-
filepath = os.path.join(root, file)
|
|
189
|
-
zip.write(filepath, file)
|
|
190
|
-
if root != files:
|
|
191
|
-
break
|
|
192
|
-
zip.close()
|
|
193
|
-
ossurl = uploadOSS(dist)
|
|
194
|
-
os.remove(dist)
|
|
195
|
-
return ossurl
|
|
196
|
-
|
|
197
|
-
def uploadOSS(file):
|
|
198
|
-
conn = http.client.HTTPSConnection("api.ryryai.com")
|
|
199
|
-
payload = json.dumps({
|
|
200
|
-
"sign": "f0463f490eb84133c0aab3a8576ed2fc"
|
|
201
|
-
})
|
|
202
|
-
headers = {
|
|
203
|
-
'Content-Type': 'application/json'
|
|
204
|
-
}
|
|
205
|
-
conn.request("POST", "/proxymsg/get_oss_config", payload, headers)
|
|
206
|
-
res = conn.getresponse()
|
|
207
|
-
data = json.loads(res.read().decode("utf-8"))
|
|
208
|
-
if data["code"] == 0:
|
|
209
|
-
AccessKeyId = data["data"]["AccessKeyId"]
|
|
210
|
-
AccessKeySecret = data["data"]["AccessKeySecret"]
|
|
211
|
-
SecurityToken = data["data"]["SecurityToken"]
|
|
212
|
-
BucketName = data["data"]["BucketName"]
|
|
213
|
-
Expiration = data["data"]["Expiration"]
|
|
214
|
-
Endpoint = data["data"]["Endpoint"]
|
|
215
|
-
CallbackUrl = data["data"]["CallbackUrl"]
|
|
216
|
-
cdn = data["data"]["cdn"]
|
|
217
|
-
|
|
218
|
-
if len(AccessKeyId) > 0:
|
|
219
|
-
import oss2
|
|
220
|
-
auth = oss2.StsAuth(AccessKeyId, AccessKeySecret, SecurityToken)
|
|
221
|
-
bucket = oss2.Bucket(auth, Endpoint, BucketName, connect_timeout=600)
|
|
222
|
-
with open(file, "rb") as f:
|
|
223
|
-
byte_data = f.read()
|
|
224
|
-
file_name = Path(file).name
|
|
225
|
-
publish_name = f"ryry/report/{file_name}"
|
|
226
|
-
bucket.put_object(publish_name, byte_data)
|
|
227
|
-
return f"{cdn}{publish_name}"
|
|
228
|
-
else:
|
|
229
|
-
print(f"get_oss_config fail: response={data}")
|
|
230
|
-
|
|
231
171
|
def process_is_alive(pid: int) -> bool:
|
|
232
172
|
try:
|
|
233
173
|
process = psutil.Process(pid)
|
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
import subprocess
|
|
4
4
|
import datetime
|
|
5
5
|
|
|
6
|
-
ryry_version = "1
|
|
6
|
+
ryry_version = "2.1"
|
|
7
7
|
ryry_build_number = int(ryry_version.replace(".",""))
|
|
8
8
|
cur_dir = os.path.dirname(os.path.abspath(__file__))
|
|
9
9
|
constanspy = os.path.join(cur_dir, "ryry", "constant.py")
|
|
@@ -24,7 +24,7 @@ app_name="ryry-cli"
|
|
|
24
24
|
except:
|
|
25
25
|
with open(constanspy, 'w') as f:
|
|
26
26
|
f.write(f'''#!!!!! do not change this file !!!!!
|
|
27
|
-
app_version="1
|
|
27
|
+
app_version="2.1"
|
|
28
28
|
app_bulld_number=1
|
|
29
29
|
app_bulld_anchor=""
|
|
30
30
|
app_name="ryry-cli"
|
ryry_cli-1.8/ryry/constant.py
DELETED
|
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
|