mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-02-09 16:24:24 +01:00
Merge pull request #870 from DenTheProgrammer/master
Easy run with bat file (with requirements check and install if needed)
This commit is contained in:
8
run.bat
Normal file
8
run.bat
Normal file
@@ -0,0 +1,8 @@
|
||||
@echo off
|
||||
python scripts/check_requirements.py requirements.txt
|
||||
if errorlevel 1 (
|
||||
echo Installing missing packages...
|
||||
pip install -r requirements.txt
|
||||
)
|
||||
python scripts/main.py %1
|
||||
pause
|
||||
3
run_continuous.bat
Normal file
3
run_continuous.bat
Normal file
@@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
set argument=--continuous
|
||||
call run.bat %argument%
|
||||
27
scripts/check_requirements.py
Normal file
27
scripts/check_requirements.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import pkg_resources
|
||||
import sys
|
||||
|
||||
def main():
|
||||
requirements_file = sys.argv[1]
|
||||
with open(requirements_file, 'r') as f:
|
||||
required_packages = [line.strip().split('#')[0].strip() for line in f.readlines()]
|
||||
|
||||
installed_packages = [package.key for package in pkg_resources.working_set]
|
||||
|
||||
missing_packages = []
|
||||
for package in required_packages:
|
||||
if not package: # Skip empty lines
|
||||
continue
|
||||
package_name = package.strip().split('==')[0]
|
||||
if package_name.lower() not in installed_packages:
|
||||
missing_packages.append(package_name)
|
||||
|
||||
if missing_packages:
|
||||
print('Missing packages:')
|
||||
print(', '.join(missing_packages))
|
||||
sys.exit(1)
|
||||
else:
|
||||
print('All packages are installed.')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user