mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Implement directory-based plugin system (#4548)
* Implement directory-based plugin system * Fix Selenium test --------- Co-authored-by: Nicholas Tindle <nick@ntindle.com> Co-authored-by: Merwane Hamadi <merwanehamadi@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
import zipfile
|
||||
from glob import glob
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -16,6 +17,8 @@ def install_plugin_dependencies():
|
||||
None
|
||||
"""
|
||||
plugins_dir = Path(os.getenv("PLUGINS_DIR", "plugins"))
|
||||
|
||||
# Install zip-based plugins
|
||||
for plugin in plugins_dir.glob("*.zip"):
|
||||
with zipfile.ZipFile(str(plugin), "r") as zfile:
|
||||
try:
|
||||
@@ -30,6 +33,13 @@ def install_plugin_dependencies():
|
||||
except KeyError:
|
||||
continue
|
||||
|
||||
# Install directory-based plugins
|
||||
for requirements_file in glob(f"{plugins_dir}/*/requirements.txt"):
|
||||
subprocess.check_call(
|
||||
[sys.executable, "-m", "pip", "install", "-r", requirements_file],
|
||||
stdout=subprocess.DEVNULL,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
install_plugin_dependencies()
|
||||
|
||||
Reference in New Issue
Block a user