ErisPulse 1.0.8__tar.gz → 1.0.9__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.
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse/__main__.py +315 -60
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse/origin.py +3 -1
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse.egg-info/PKG-INFO +5 -1
- erispulse-1.0.9/ErisPulse.egg-info/requires.txt +3 -0
- {erispulse-1.0.8 → erispulse-1.0.9}/PKG-INFO +5 -1
- {erispulse-1.0.8 → erispulse-1.0.9}/README.md +4 -1
- {erispulse-1.0.8 → erispulse-1.0.9}/setup.py +2 -2
- erispulse-1.0.8/ErisPulse.egg-info/requires.txt +0 -2
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse/__init__.py +0 -0
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse/envManager.py +0 -0
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse/errors.py +0 -0
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse/logger.py +0 -0
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse/sdk.py +0 -0
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse/util.py +0 -0
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse.egg-info/SOURCES.txt +0 -0
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse.egg-info/dependency_links.txt +0 -0
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse.egg-info/entry_points.txt +0 -0
- {erispulse-1.0.8 → erispulse-1.0.9}/ErisPulse.egg-info/top_level.txt +0 -0
- {erispulse-1.0.8 → erispulse-1.0.9}/setup.cfg +0 -0
|
@@ -4,6 +4,7 @@ import sys
|
|
|
4
4
|
import shutil
|
|
5
5
|
import aiohttp
|
|
6
6
|
import zipfile
|
|
7
|
+
import fnmatch
|
|
7
8
|
import asyncio
|
|
8
9
|
import subprocess
|
|
9
10
|
import json
|
|
@@ -11,6 +12,7 @@ from rich.console import Console
|
|
|
11
12
|
from rich.table import Table
|
|
12
13
|
from rich.panel import Panel
|
|
13
14
|
from rich.prompt import Prompt, Confirm
|
|
15
|
+
from rich import box
|
|
14
16
|
from prompt_toolkit import PromptSession
|
|
15
17
|
from prompt_toolkit.completion import WordCompleter
|
|
16
18
|
from prompt_toolkit.formatted_text import HTML
|
|
@@ -22,18 +24,34 @@ console = Console()
|
|
|
22
24
|
def enable_module(module_name):
|
|
23
25
|
module_info = env.get_module(module_name)
|
|
24
26
|
if module_info:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
with console.status(f"[cyan]正在启用模块 {module_name}...[/cyan]"):
|
|
28
|
+
env.set_module_status(module_name, True)
|
|
29
|
+
console.print(Panel(
|
|
30
|
+
f"[green]✓ 模块 {module_name} 已成功启用[/green]",
|
|
31
|
+
border_style="green"
|
|
32
|
+
))
|
|
27
33
|
else:
|
|
28
|
-
console.print(
|
|
34
|
+
console.print(Panel(
|
|
35
|
+
f"[red]模块 {module_name} 不存在[/red]",
|
|
36
|
+
title="错误",
|
|
37
|
+
border_style="red"
|
|
38
|
+
))
|
|
29
39
|
|
|
30
40
|
def disable_module(module_name):
|
|
31
41
|
module_info = env.get_module(module_name)
|
|
32
42
|
if module_info:
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
with console.status(f"[cyan]正在禁用模块 {module_name}...[/cyan]"):
|
|
44
|
+
env.set_module_status(module_name, False)
|
|
45
|
+
console.print(Panel(
|
|
46
|
+
f"[yellow]✓ 模块 {module_name} 已成功禁用[/yellow]",
|
|
47
|
+
border_style="yellow"
|
|
48
|
+
))
|
|
35
49
|
else:
|
|
36
|
-
console.print(
|
|
50
|
+
console.print(Panel(
|
|
51
|
+
f"[red]模块 {module_name} 不存在[/red]",
|
|
52
|
+
title="错误",
|
|
53
|
+
border_style="red"
|
|
54
|
+
))
|
|
37
55
|
|
|
38
56
|
async def fetch_url(session, url):
|
|
39
57
|
try:
|
|
@@ -117,10 +135,43 @@ def install_pip_dependencies(dependencies):
|
|
|
117
135
|
return False
|
|
118
136
|
|
|
119
137
|
def install_module(module_name, force=False):
|
|
138
|
+
# 显示安装摘要
|
|
139
|
+
console.print(Panel.fit(
|
|
140
|
+
f"[bold]准备安装模块:[/bold] [cyan]{module_name}[/cyan]",
|
|
141
|
+
title="安装摘要",
|
|
142
|
+
border_style="blue"
|
|
143
|
+
))
|
|
144
|
+
|
|
145
|
+
last_update_time = env.get('last_origin_update_time', None)
|
|
146
|
+
if last_update_time:
|
|
147
|
+
from datetime import datetime, timedelta
|
|
148
|
+
last_update = datetime.fromisoformat(last_update_time)
|
|
149
|
+
if datetime.now() - last_update > timedelta(hours=0):
|
|
150
|
+
console.print(Panel(
|
|
151
|
+
"[yellow]距离上次源更新已超过72小时,源内可能有新模块或更新。[/yellow]",
|
|
152
|
+
border_style="yellow"
|
|
153
|
+
))
|
|
154
|
+
update_confirmation = Confirm.ask(
|
|
155
|
+
"[yellow]是否在安装模块前更新源?[/yellow]",
|
|
156
|
+
default=True
|
|
157
|
+
)
|
|
158
|
+
if update_confirmation:
|
|
159
|
+
with console.status("[cyan]正在更新源...[/cyan]"):
|
|
160
|
+
origin_manager.update_origins()
|
|
161
|
+
env.set('last_origin_update_time', datetime.now().isoformat())
|
|
162
|
+
console.print("[green]✓ 源更新完成[/green]")
|
|
163
|
+
|
|
120
164
|
module_info = env.get_module(module_name)
|
|
121
165
|
if module_info and not force:
|
|
122
|
-
console.print(
|
|
123
|
-
|
|
166
|
+
console.print(Panel(
|
|
167
|
+
f"[yellow]模块 {module_name} 已存在[/yellow]\n"
|
|
168
|
+
f"版本: {module_info['info'].get('version', '未知')}\n"
|
|
169
|
+
f"描述: {module_info['info'].get('description', '无描述')}",
|
|
170
|
+
title="模块已存在",
|
|
171
|
+
border_style="yellow"
|
|
172
|
+
))
|
|
173
|
+
if not Confirm.ask("[yellow]是否要强制重新安装?[/yellow]", default=False):
|
|
174
|
+
return
|
|
124
175
|
|
|
125
176
|
providers = env.get('providers', {})
|
|
126
177
|
if isinstance(providers, str):
|
|
@@ -148,7 +199,15 @@ def install_module(module_name, force=False):
|
|
|
148
199
|
})
|
|
149
200
|
|
|
150
201
|
if not module_info:
|
|
151
|
-
console.print(
|
|
202
|
+
console.print(Panel(
|
|
203
|
+
f"[red]未找到模块 {module_name}[/red]",
|
|
204
|
+
title="错误",
|
|
205
|
+
border_style="red"
|
|
206
|
+
))
|
|
207
|
+
if providers:
|
|
208
|
+
console.print("[cyan]当前可用源:[/cyan]")
|
|
209
|
+
for provider in providers:
|
|
210
|
+
console.print(f" - {provider}")
|
|
152
211
|
return
|
|
153
212
|
|
|
154
213
|
if len(module_info) > 1:
|
|
@@ -211,27 +270,65 @@ def install_module(module_name, force=False):
|
|
|
211
270
|
console.print(f"[green]模块 {module_name} 安装成功[/green]")
|
|
212
271
|
|
|
213
272
|
def uninstall_module(module_name):
|
|
273
|
+
# 显示卸载摘要
|
|
274
|
+
console.print(Panel.fit(
|
|
275
|
+
f"[bold]准备卸载模块:[/bold] [cyan]{module_name}[/cyan]",
|
|
276
|
+
title="卸载摘要",
|
|
277
|
+
border_style="blue"
|
|
278
|
+
))
|
|
279
|
+
|
|
280
|
+
module_info = env.get_module(module_name)
|
|
281
|
+
if not module_info:
|
|
282
|
+
console.print(Panel(
|
|
283
|
+
f"[red]模块 {module_name} 不存在[/red]",
|
|
284
|
+
title="错误",
|
|
285
|
+
border_style="red"
|
|
286
|
+
))
|
|
287
|
+
return
|
|
288
|
+
|
|
289
|
+
# 显示模块信息
|
|
290
|
+
console.print(Panel(
|
|
291
|
+
f"版本: {module_info['info'].get('version', '未知')}\n"
|
|
292
|
+
f"描述: {module_info['info'].get('description', '无描述')}\n"
|
|
293
|
+
f"pip依赖: {', '.join(module_info['info'].get('pip_dependencies', [])) or '无'}",
|
|
294
|
+
title="模块信息",
|
|
295
|
+
border_style="green"
|
|
296
|
+
))
|
|
297
|
+
|
|
298
|
+
if not Confirm.ask("[red]确认要卸载此模块吗?[/red]", default=False):
|
|
299
|
+
console.print("[yellow]卸载已取消[/yellow]")
|
|
300
|
+
return
|
|
301
|
+
|
|
214
302
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
215
303
|
module_path = os.path.join(script_dir, 'modules', module_name)
|
|
216
304
|
|
|
217
305
|
module_file_path = module_path + '.py'
|
|
218
306
|
if os.path.exists(module_file_path):
|
|
219
307
|
try:
|
|
220
|
-
|
|
308
|
+
with console.status(f"[cyan]正在删除模块文件 {module_name}...[/cyan]"):
|
|
309
|
+
os.remove(module_file_path)
|
|
221
310
|
except Exception as e:
|
|
222
|
-
console.print(
|
|
311
|
+
console.print(Panel(
|
|
312
|
+
f"[red]删除模块文件 {module_name} 时出错: {e}[/red]",
|
|
313
|
+
title="错误",
|
|
314
|
+
border_style="red"
|
|
315
|
+
))
|
|
223
316
|
elif os.path.exists(module_path) and os.path.isdir(module_path):
|
|
224
317
|
try:
|
|
225
|
-
|
|
318
|
+
with console.status(f"[cyan]正在删除模块目录 {module_name}...[/cyan]"):
|
|
319
|
+
shutil.rmtree(module_path)
|
|
226
320
|
except Exception as e:
|
|
227
|
-
console.print(
|
|
321
|
+
console.print(Panel(
|
|
322
|
+
f"[red]删除模块目录 {module_name} 时出错: {e}[/red]",
|
|
323
|
+
title="错误",
|
|
324
|
+
border_style="red"
|
|
325
|
+
))
|
|
228
326
|
else:
|
|
229
|
-
console.print(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
console.print(f"[red]模块 {module_name} 不存在[/red]")
|
|
327
|
+
console.print(Panel(
|
|
328
|
+
f"[red]模块 {module_name} 不存在[/red]",
|
|
329
|
+
title="错误",
|
|
330
|
+
border_style="red"
|
|
331
|
+
))
|
|
235
332
|
return
|
|
236
333
|
|
|
237
334
|
pip_dependencies = module_info.get('info', {}).get('pip_dependencies', [])
|
|
@@ -255,25 +352,43 @@ def uninstall_module(module_name):
|
|
|
255
352
|
unused_pip_dependencies.append(dep)
|
|
256
353
|
|
|
257
354
|
if unused_pip_dependencies:
|
|
258
|
-
console.print(
|
|
355
|
+
console.print(Panel(
|
|
356
|
+
f"以下 pip 依赖不再被其他模块使用:\n{', '.join(unused_pip_dependencies)}",
|
|
357
|
+
title="可卸载依赖",
|
|
358
|
+
border_style="cyan"
|
|
359
|
+
))
|
|
259
360
|
confirm = Confirm.ask("[yellow]是否卸载这些 pip 依赖?[/yellow]", default=False)
|
|
260
361
|
if confirm:
|
|
261
|
-
console.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
362
|
+
with console.status(f"[cyan]正在卸载 pip 依赖: {', '.join(unused_pip_dependencies)}[/cyan]"):
|
|
363
|
+
try:
|
|
364
|
+
subprocess.run(
|
|
365
|
+
[sys.executable, "-m", "pip", "uninstall", "-y"] + unused_pip_dependencies,
|
|
366
|
+
check=True,
|
|
367
|
+
stdout=subprocess.PIPE,
|
|
368
|
+
stderr=subprocess.PIPE
|
|
369
|
+
)
|
|
370
|
+
console.print(Panel(
|
|
371
|
+
f"[green]成功卸载 pip 依赖: {', '.join(unused_pip_dependencies)}[/green]",
|
|
372
|
+
border_style="green"
|
|
373
|
+
))
|
|
374
|
+
except subprocess.CalledProcessError as e:
|
|
375
|
+
console.print(Panel(
|
|
376
|
+
f"[red]卸载 pip 依赖失败: {e.stderr.decode()}[/red]",
|
|
377
|
+
title="错误",
|
|
378
|
+
border_style="red"
|
|
379
|
+
))
|
|
272
380
|
|
|
273
381
|
if env.remove_module(module_name):
|
|
274
|
-
console.print(
|
|
382
|
+
console.print(Panel(
|
|
383
|
+
f"[green]✓ 模块 {module_name} 已成功卸载[/green]",
|
|
384
|
+
border_style="green"
|
|
385
|
+
))
|
|
275
386
|
else:
|
|
276
|
-
console.print(
|
|
387
|
+
console.print(Panel(
|
|
388
|
+
f"[red]模块 {module_name} 不存在[/red]",
|
|
389
|
+
title="错误",
|
|
390
|
+
border_style="red"
|
|
391
|
+
))
|
|
277
392
|
def upgrade_all_modules(force=False):
|
|
278
393
|
all_modules = env.get_all_modules()
|
|
279
394
|
if not all_modules:
|
|
@@ -348,31 +463,51 @@ def upgrade_all_modules(force=False):
|
|
|
348
463
|
def list_modules(module_name=None):
|
|
349
464
|
all_modules = env.get_all_modules()
|
|
350
465
|
if not all_modules:
|
|
351
|
-
console.print(
|
|
466
|
+
console.print(Panel(
|
|
467
|
+
"[yellow]未在数据库中发现注册模块,正在初始化模块列表...[/yellow]",
|
|
468
|
+
border_style="yellow"
|
|
469
|
+
))
|
|
352
470
|
from . import init as init_module
|
|
353
471
|
init_module()
|
|
354
472
|
all_modules = env.get_all_modules()
|
|
355
473
|
|
|
356
474
|
if not all_modules:
|
|
357
|
-
console.print(
|
|
475
|
+
console.print(Panel(
|
|
476
|
+
"[red]未找到任何模块[/red]",
|
|
477
|
+
title="错误",
|
|
478
|
+
border_style="red"
|
|
479
|
+
))
|
|
358
480
|
return
|
|
359
481
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
table
|
|
367
|
-
|
|
482
|
+
# 显示模块总数
|
|
483
|
+
console.print(Panel.fit(
|
|
484
|
+
f"[bold]找到 {len(all_modules)} 个模块[/bold]",
|
|
485
|
+
border_style="blue"
|
|
486
|
+
))
|
|
487
|
+
|
|
488
|
+
table = Table(
|
|
489
|
+
title="模块列表",
|
|
490
|
+
show_header=True,
|
|
491
|
+
header_style="bold magenta",
|
|
492
|
+
expand=True,
|
|
493
|
+
box=box.ROUNDED
|
|
494
|
+
)
|
|
495
|
+
table.add_column("模块名称", style="cyan", min_width=20)
|
|
496
|
+
table.add_column("状态", style="green", justify="center")
|
|
497
|
+
table.add_column("版本", style="blue", justify="center")
|
|
498
|
+
table.add_column("描述", style="white", min_width=30)
|
|
499
|
+
table.add_column("依赖", style="yellow", min_width=15)
|
|
500
|
+
table.add_column("可选依赖", style="magenta", min_width=15)
|
|
501
|
+
table.add_column("pip依赖", style="cyan", min_width=20)
|
|
368
502
|
|
|
369
503
|
for name, info in all_modules.items():
|
|
370
|
-
status = "
|
|
371
|
-
dependencies = '
|
|
372
|
-
optional_dependencies = '
|
|
373
|
-
pip_dependencies = '
|
|
504
|
+
status = "[green]✓[/green]" if info.get("status", True) else "[red]✗[/red]"
|
|
505
|
+
dependencies = '\n'.join(info['info'].get('dependencies', [])) if info['info'].get('dependencies') else '无'
|
|
506
|
+
optional_dependencies = '\n'.join(info['info'].get('optional_dependencies', [])) if info['info'].get('optional_dependencies') else '无'
|
|
507
|
+
pip_dependencies = '\n'.join(info['info'].get('pip_dependencies', [])) if info['info'].get('pip_dependencies') else '无'
|
|
508
|
+
|
|
374
509
|
table.add_row(
|
|
375
|
-
name,
|
|
510
|
+
f"[bold]{name}[/bold]",
|
|
376
511
|
status,
|
|
377
512
|
info['info'].get('version', '未知'),
|
|
378
513
|
info['info'].get('description', '无描述'),
|
|
@@ -383,6 +518,15 @@ def list_modules(module_name=None):
|
|
|
383
518
|
|
|
384
519
|
console.print(table)
|
|
385
520
|
|
|
521
|
+
# 显示模块状态统计
|
|
522
|
+
enabled_count = sum(1 for m in all_modules.values() if m.get("status", True))
|
|
523
|
+
disabled_count = len(all_modules) - enabled_count
|
|
524
|
+
console.print(Panel(
|
|
525
|
+
f"[green]已启用: {enabled_count}[/green] [red]已禁用: {disabled_count}[/red]",
|
|
526
|
+
title="模块状态统计",
|
|
527
|
+
border_style="blue"
|
|
528
|
+
))
|
|
529
|
+
|
|
386
530
|
def main():
|
|
387
531
|
parser = argparse.ArgumentParser(
|
|
388
532
|
description="ErisPulse 命令行工具",
|
|
@@ -392,11 +536,11 @@ def main():
|
|
|
392
536
|
|
|
393
537
|
# 添加子命令解析器(与原代码一致)
|
|
394
538
|
enable_parser = subparsers.add_parser('enable', help='启用指定模块')
|
|
395
|
-
enable_parser.add_argument('
|
|
539
|
+
enable_parser.add_argument('module_names', nargs='+', help='要启用的模块名称(支持多个模块,用空格分隔)')
|
|
396
540
|
enable_parser.add_argument('--init', action='store_true', help='在启用模块前初始化模块数据库')
|
|
397
541
|
|
|
398
542
|
disable_parser = subparsers.add_parser('disable', help='禁用指定模块')
|
|
399
|
-
disable_parser.add_argument('
|
|
543
|
+
disable_parser.add_argument('module_names', nargs='+', help='要禁用的模块名称(支持多个模块,用空格分隔)')
|
|
400
544
|
disable_parser.add_argument('--init', action='store_true', help='在禁用模块前初始化模块数据库')
|
|
401
545
|
|
|
402
546
|
list_parser = subparsers.add_parser('list', help='列出所有模块信息')
|
|
@@ -408,10 +552,10 @@ def main():
|
|
|
408
552
|
upgrade_parser.add_argument('--force', action='store_true', help='跳过二次确认,强制更新')
|
|
409
553
|
|
|
410
554
|
uninstall_parser = subparsers.add_parser('uninstall', help='删除指定模块')
|
|
411
|
-
uninstall_parser.add_argument('
|
|
555
|
+
uninstall_parser.add_argument('module_names', nargs='+', help='要卸载的模块名称(支持多个模块,用空格分隔)')
|
|
412
556
|
|
|
413
|
-
install_parser = subparsers.add_parser('install', help='
|
|
414
|
-
install_parser.add_argument('module_name',
|
|
557
|
+
install_parser = subparsers.add_parser('install', help='安装指定模块(支持多个模块,用空格分隔)')
|
|
558
|
+
install_parser.add_argument('module_name', nargs='+', help='要安装的模块名称(支持多个模块,用空格分隔)')
|
|
415
559
|
install_parser.add_argument('--force', action='store_true', help='强制重新安装模块')
|
|
416
560
|
install_parser.add_argument('--init', action='store_true', help='在安装模块前初始化模块数据库')
|
|
417
561
|
|
|
@@ -435,18 +579,125 @@ def main():
|
|
|
435
579
|
init_module()
|
|
436
580
|
|
|
437
581
|
if args.command == 'enable':
|
|
438
|
-
|
|
582
|
+
for module_name in args.module_names:
|
|
583
|
+
module_name = module_name.strip()
|
|
584
|
+
if not module_name:
|
|
585
|
+
continue
|
|
586
|
+
if '*' in module_name or '?' in module_name:
|
|
587
|
+
console.print(f"[cyan]正在匹配模块模式: {module_name}...[/cyan]")
|
|
588
|
+
all_modules = env.get_all_modules()
|
|
589
|
+
if not all_modules:
|
|
590
|
+
console.print(Panel("[red]未找到任何模块,请先更新源或检查配置[/red]", title="错误", border_style="red"))
|
|
591
|
+
continue
|
|
592
|
+
matched_modules = [name for name in all_modules.keys() if fnmatch.fnmatch(name, module_name)]
|
|
593
|
+
if not matched_modules:
|
|
594
|
+
console.print(Panel(f"[red]未找到匹配模块模式 {module_name} 的模块[/red]", title="错误", border_style="red"))
|
|
595
|
+
continue
|
|
596
|
+
console.print(f"[green]找到 {len(matched_modules)} 个匹配模块:[/green]")
|
|
597
|
+
for i, matched_module in enumerate(matched_modules, start=1):
|
|
598
|
+
console.print(f" {i}. {matched_module}")
|
|
599
|
+
confirm = Confirm.ask("[yellow]是否启用所有匹配模块?[/yellow]", default=True)
|
|
600
|
+
if not confirm:
|
|
601
|
+
console.print("[yellow]操作已取消[/yellow]")
|
|
602
|
+
continue
|
|
603
|
+
for matched_module in matched_modules:
|
|
604
|
+
enable_module(matched_module)
|
|
605
|
+
else:
|
|
606
|
+
enable_module(module_name)
|
|
439
607
|
elif args.command == 'disable':
|
|
440
|
-
|
|
608
|
+
for module_name in args.module_names:
|
|
609
|
+
module_name = module_name.strip()
|
|
610
|
+
if not module_name:
|
|
611
|
+
continue
|
|
612
|
+
if '*' in module_name or '?' in module_name:
|
|
613
|
+
console.print(f"[cyan]正在匹配模块模式: {module_name}...[/cyan]")
|
|
614
|
+
all_modules = env.get_all_modules()
|
|
615
|
+
if not all_modules:
|
|
616
|
+
console.print(Panel("[red]未找到任何模块,请先更新源或检查配置[/red]", title="错误", border_style="red"))
|
|
617
|
+
continue
|
|
618
|
+
matched_modules = [name for name in all_modules.keys() if fnmatch.fnmatch(name, module_name)]
|
|
619
|
+
if not matched_modules:
|
|
620
|
+
console.print(Panel(f"[red]未找到匹配模块模式 {module_name} 的模块[/red]", title="错误", border_style="red"))
|
|
621
|
+
continue
|
|
622
|
+
console.print(f"[green]找到 {len(matched_modules)} 个匹配模块:[/green]")
|
|
623
|
+
for i, matched_module in enumerate(matched_modules, start=1):
|
|
624
|
+
console.print(f" {i}. {matched_module}")
|
|
625
|
+
confirm = Confirm.ask("[yellow]是否禁用所有匹配模块?[/yellow]", default=True)
|
|
626
|
+
if not confirm:
|
|
627
|
+
console.print("[yellow]操作已取消[/yellow]")
|
|
628
|
+
continue
|
|
629
|
+
for matched_module in matched_modules:
|
|
630
|
+
disable_module(matched_module)
|
|
631
|
+
else:
|
|
632
|
+
disable_module(module_name)
|
|
441
633
|
elif args.command == 'list':
|
|
442
634
|
list_modules(args.module)
|
|
443
635
|
elif args.command == 'uninstall':
|
|
444
|
-
|
|
636
|
+
for module_name in args.module_names:
|
|
637
|
+
module_name = module_name.strip()
|
|
638
|
+
if not module_name:
|
|
639
|
+
continue
|
|
640
|
+
if '*' in module_name or '?' in module_name:
|
|
641
|
+
console.print(f"[cyan]正在匹配模块模式: {module_name}...[/cyan]")
|
|
642
|
+
all_modules = env.get_all_modules()
|
|
643
|
+
if not all_modules:
|
|
644
|
+
console.print(Panel("[red]未找到任何模块,请先更新源或检查配置[/red]", title="错误", border_style="red"))
|
|
645
|
+
continue
|
|
646
|
+
matched_modules = [name for name in all_modules.keys() if fnmatch.fnmatch(name, module_name)]
|
|
647
|
+
if not matched_modules:
|
|
648
|
+
console.print(Panel(f"[red]未找到匹配模块模式 {module_name} 的模块[/red]", title="错误", border_style="red"))
|
|
649
|
+
continue
|
|
650
|
+
console.print(f"[green]找到 {len(matched_modules)} 个匹配模块:[/green]")
|
|
651
|
+
for i, matched_module in enumerate(matched_modules, start=1):
|
|
652
|
+
console.print(f" {i}. {matched_module}")
|
|
653
|
+
confirm = Confirm.ask("[yellow]是否卸载所有匹配模块?[/yellow]", default=True)
|
|
654
|
+
if not confirm:
|
|
655
|
+
console.print("[yellow]操作已取消[/yellow]")
|
|
656
|
+
continue
|
|
657
|
+
for matched_module in matched_modules:
|
|
658
|
+
uninstall_module(matched_module)
|
|
659
|
+
else:
|
|
660
|
+
uninstall_module(module_name)
|
|
445
661
|
elif args.command == 'install':
|
|
446
|
-
|
|
447
|
-
for module_name in module_names:
|
|
662
|
+
for module_name in args.module_name:
|
|
448
663
|
module_name = module_name.strip()
|
|
449
|
-
if module_name:
|
|
664
|
+
if not module_name:
|
|
665
|
+
continue
|
|
666
|
+
if '*' in module_name or '?' in module_name:
|
|
667
|
+
console.print(f"[cyan]正在匹配模块模式: {module_name}...[/cyan]")
|
|
668
|
+
all_modules = env.get_all_modules()
|
|
669
|
+
if not all_modules:
|
|
670
|
+
console.print(Panel(
|
|
671
|
+
"[red]未找到任何模块,请先更新源或检查配置[/red]",
|
|
672
|
+
title="错误",
|
|
673
|
+
border_style="red"
|
|
674
|
+
))
|
|
675
|
+
continue
|
|
676
|
+
|
|
677
|
+
matched_modules = [
|
|
678
|
+
name for name in all_modules.keys() if fnmatch.fnmatch(name, module_name)
|
|
679
|
+
]
|
|
680
|
+
|
|
681
|
+
if not matched_modules:
|
|
682
|
+
console.print(Panel(
|
|
683
|
+
f"[red]未找到匹配模块模式 {module_name} 的模块[/red]",
|
|
684
|
+
title="错误",
|
|
685
|
+
border_style="red"
|
|
686
|
+
))
|
|
687
|
+
continue
|
|
688
|
+
|
|
689
|
+
console.print(f"[green]找到 {len(matched_modules)} 个匹配模块:[/green]")
|
|
690
|
+
for i, matched_module in enumerate(matched_modules, start=1):
|
|
691
|
+
console.print(f" {i}. {matched_module}")
|
|
692
|
+
|
|
693
|
+
confirm = Confirm.ask("[yellow]是否安装所有匹配模块?[/yellow]", default=True)
|
|
694
|
+
if not confirm:
|
|
695
|
+
console.print("[yellow]安装已取消[/yellow]")
|
|
696
|
+
continue
|
|
697
|
+
|
|
698
|
+
for matched_module in matched_modules:
|
|
699
|
+
install_module(matched_module, args.force)
|
|
700
|
+
else:
|
|
450
701
|
install_module(module_name, args.force)
|
|
451
702
|
elif args.command == 'update':
|
|
452
703
|
origin_manager.update_origins()
|
|
@@ -454,7 +705,11 @@ def main():
|
|
|
454
705
|
upgrade_all_modules(args.force)
|
|
455
706
|
elif args.command == 'origin':
|
|
456
707
|
if args.origin_command == 'add':
|
|
457
|
-
origin_manager.add_origin(args.url)
|
|
708
|
+
success = origin_manager.add_origin(args.url)
|
|
709
|
+
if success:
|
|
710
|
+
update_confirmation = Confirm.ask("[yellow]源已添加,是否立即更新源以获取最新模块信息?[/yellow]", default=True)
|
|
711
|
+
if update_confirmation:
|
|
712
|
+
origin_manager.update_origins()
|
|
458
713
|
elif args.origin_command == 'list':
|
|
459
714
|
origin_manager.list_origins()
|
|
460
715
|
elif args.origin_command == 'del':
|
|
@@ -39,15 +39,17 @@ class OriginManager:
|
|
|
39
39
|
validated_url = asyncio.run(self._validate_url(value))
|
|
40
40
|
if not validated_url:
|
|
41
41
|
print("提供的源不是一个有效源,请检查后重试。")
|
|
42
|
-
return
|
|
42
|
+
return False
|
|
43
43
|
|
|
44
44
|
origins = env.get('origins')
|
|
45
45
|
if validated_url not in origins:
|
|
46
46
|
origins.append(validated_url)
|
|
47
47
|
env.set('origins', origins)
|
|
48
48
|
print(f"源 {validated_url} 已成功添加。")
|
|
49
|
+
return True
|
|
49
50
|
else:
|
|
50
51
|
print(f"源 {validated_url} 已存在,无需重复添加。")
|
|
52
|
+
return False
|
|
51
53
|
|
|
52
54
|
def update_origins(self):
|
|
53
55
|
origins = env.get('origins')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ErisPulse
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.9
|
|
4
4
|
Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
|
|
5
5
|
Home-page: https://github.com/wsu2059q/ErisPulse
|
|
6
6
|
Author: 艾莉丝·格雷拉特(WSu2059)
|
|
@@ -25,6 +25,7 @@ Requires-Python: >=3.7
|
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
26
|
Requires-Dist: aiohttp
|
|
27
27
|
Requires-Dist: rich
|
|
28
|
+
Requires-Dist: prompt_toolkit
|
|
28
29
|
Dynamic: author
|
|
29
30
|
Dynamic: author-email
|
|
30
31
|
Dynamic: classifier
|
|
@@ -59,3 +60,6 @@ ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用
|
|
|
59
60
|
|
|
60
61
|
## 1.0.8
|
|
61
62
|
现在包会被添加至系统环境,用户可以直接通过命令行'ep'或'epsdk'命令调用cli
|
|
63
|
+
|
|
64
|
+
## 1.0.9
|
|
65
|
+
修复了部分命令行参数的错误
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ErisPulse
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.9
|
|
4
4
|
Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
|
|
5
5
|
Home-page: https://github.com/wsu2059q/ErisPulse
|
|
6
6
|
Author: 艾莉丝·格雷拉特(WSu2059)
|
|
@@ -25,6 +25,7 @@ Requires-Python: >=3.7
|
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
26
|
Requires-Dist: aiohttp
|
|
27
27
|
Requires-Dist: rich
|
|
28
|
+
Requires-Dist: prompt_toolkit
|
|
28
29
|
Dynamic: author
|
|
29
30
|
Dynamic: author-email
|
|
30
31
|
Dynamic: classifier
|
|
@@ -59,3 +60,6 @@ ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用
|
|
|
59
60
|
|
|
60
61
|
## 1.0.8
|
|
61
62
|
现在包会被添加至系统环境,用户可以直接通过命令行'ep'或'epsdk'命令调用cli
|
|
63
|
+
|
|
64
|
+
## 1.0.9
|
|
65
|
+
修复了部分命令行参数的错误
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='ErisPulse',
|
|
5
|
-
version='1.0.
|
|
5
|
+
version='1.0.9',
|
|
6
6
|
author='艾莉丝·格雷拉特(WSu2059)',
|
|
7
7
|
author_email='wsu2059@qq.com',
|
|
8
8
|
maintainer='runoneall',
|
|
@@ -12,7 +12,7 @@ setup(
|
|
|
12
12
|
long_description_content_type='text/markdown',
|
|
13
13
|
url='https://github.com/wsu2059q/ErisPulse',
|
|
14
14
|
packages=find_packages(),
|
|
15
|
-
install_requires=["aiohttp", "rich"],
|
|
15
|
+
install_requires=["aiohttp", "rich","prompt_toolkit"],
|
|
16
16
|
license='MIT',
|
|
17
17
|
classifiers=[
|
|
18
18
|
'Development Status :: 5 - Production/Stable',
|
|
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
|