ErisPulse 1.0.4__zip → 1.0.5__zip

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.
@@ -5,6 +5,7 @@ import shutil
5
5
  import aiohttp
6
6
  import zipfile
7
7
  import asyncio
8
+ import subprocess
8
9
  from .envManager import env
9
10
  from .origin import origin_manager
10
11
 
@@ -85,6 +86,25 @@ def extract_and_setup_module(module_name, module_url, zip_path, module_dir):
85
86
  except Exception as cleanup_error:
86
87
  print(f"清理失败: {cleanup_error}")
87
88
 
89
+
90
+ def install_pip_dependencies(dependencies):
91
+ if not dependencies:
92
+ return True
93
+
94
+ print("正在安装pip依赖...")
95
+ try:
96
+ result = subprocess.run(
97
+ [sys.executable, "-m", "pip", "install"] + dependencies,
98
+ check=True,
99
+ stdout=subprocess.PIPE,
100
+ stderr=subprocess.PIPE
101
+ )
102
+ print(result.stdout.decode())
103
+ return True
104
+ except subprocess.CalledProcessError as e:
105
+ print(f"安装pip依赖失败: {e.stderr.decode()}")
106
+ return False
107
+
88
108
  def install_module(module_name, force=False):
89
109
  module_info = env.get_module(module_name)
90
110
  if module_info and not force:
@@ -94,8 +114,8 @@ def install_module(module_name, force=False):
94
114
  providers = env.get('providers', {})
95
115
  if isinstance(providers, str):
96
116
  providers = json.loads(providers)
97
- module_info = []
98
117
 
118
+ module_info = []
99
119
  for provider, url in providers.items():
100
120
  module_key = f"{module_name}@{provider}"
101
121
  modules_data = env.get('modules', {})
@@ -112,7 +132,8 @@ def install_module(module_name, force=False):
112
132
  'description': module_data.get('description', '无描述'),
113
133
  'author': module_data.get('author', '未知'),
114
134
  'dependencies': module_data.get('dependencies', []),
115
- 'optional_dependencies': module_data.get('optional_dependencies', [])
135
+ 'optional_dependencies': module_data.get('optional_dependencies', []),
136
+ 'pip_dependencies': module_data.get('pip_dependencies', [])
116
137
  })
117
138
 
118
139
  if not module_info:
@@ -146,14 +167,13 @@ def install_module(module_name, force=False):
146
167
  print(f"正在安装依赖模块 {dep}...")
147
168
  install_module(dep)
148
169
 
149
- if selected_module['optional_dependencies']:
150
- optional_deps_message = []
151
- for dep in selected_module['optional_dependencies']:
152
- if isinstance(dep, list):
153
- optional_deps_message.append(f"组合: {' + '.join(dep)}")
154
- else:
155
- optional_deps_message.append(f"模块: {dep}")
156
- print("\033[93m\033[1m" + f"模块 {module_name} 有可选依赖:{', '.join(optional_deps_message)},请稍后手动选择安装!" + "\033[0m")
170
+ third_party_deps = selected_module.get('pip_dependencies', [])
171
+ if third_party_deps:
172
+ print(f"模块 {module_name} 需要以下pip依赖: {', '.join(third_party_deps)}")
173
+ if not install_pip_dependencies(third_party_deps):
174
+ print(f"无法安装模块 {module_name} 的pip依赖,安装终止")
175
+ return
176
+
157
177
  module_url = selected_module['url'] + selected_module['path']
158
178
  script_dir = os.path.dirname(os.path.abspath(__file__))
159
179
  module_dir = os.path.join(script_dir, 'modules', module_name)
@@ -166,6 +186,7 @@ def install_module(module_name, force=False):
166
186
  module_dir=module_dir
167
187
  ):
168
188
  return
189
+
169
190
  env.set_module(module_name, {
170
191
  'status': True,
171
192
  'info': {
@@ -173,7 +194,8 @@ def install_module(module_name, force=False):
173
194
  'description': selected_module['description'],
174
195
  'author': selected_module['author'],
175
196
  'dependencies': selected_module['dependencies'],
176
- 'optional_dependencies': selected_module['optional_dependencies']
197
+ 'optional_dependencies': selected_module['optional_dependencies'],
198
+ 'pip_dependencies': selected_module['pip_dependencies']
177
199
  }
178
200
  })
179
201
  print(f"模块 {module_name} 安装成功")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse
3
- Version: 1.0.4
3
+ Version: 1.0.5
4
4
  Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
5
5
  Home-page: https://github.com/wsu2059q/ErisPulse
6
6
  Author: 艾莉丝·格雷拉特(WSu2059)
@@ -35,7 +35,7 @@ Dynamic: requires-python
35
35
  Dynamic: summary
36
36
 
37
37
  ### 版本更新小通知~
38
- - 此版本(1.0.4)修复了部分命令行不支持logger颜色代码的问题 | 替换为rich
38
+ - 此版本(1.0.5)更新了模块对于pip依赖安装的支持
39
39
 
40
40
  # ErisPulse
41
41
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse
3
- Version: 1.0.4
3
+ Version: 1.0.5
4
4
  Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
5
5
  Home-page: https://github.com/wsu2059q/ErisPulse
6
6
  Author: 艾莉丝·格雷拉特(WSu2059)
@@ -35,7 +35,7 @@ Dynamic: requires-python
35
35
  Dynamic: summary
36
36
 
37
37
  ### 版本更新小通知~
38
- - 此版本(1.0.4)修复了部分命令行不支持logger颜色代码的问题 | 替换为rich
38
+ - 此版本(1.0.5)更新了模块对于pip依赖安装的支持
39
39
 
40
40
  # ErisPulse
41
41
 
@@ -1,5 +1,5 @@
1
1
  ### 版本更新小通知~
2
- - 此版本(1.0.4)修复了部分命令行不支持logger颜色代码的问题 | 替换为rich
2
+ - 此版本(1.0.5)更新了模块对于pip依赖安装的支持
3
3
 
4
4
  # ErisPulse
5
5
 
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='ErisPulse',
5
- version='1.0.4',
5
+ version='1.0.5',
6
6
  author='艾莉丝·格雷拉特(WSu2059)',
7
7
  author_email='wsu2059@qq.com',
8
8
  maintainer='runoneall',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes