|
import os |
|
import sys |
|
import subprocess |
|
import shutil |
|
|
|
def check_python_version(): |
|
if sys.version_info < (3, 8): |
|
print("β Python 3.8+ is required. You are using:", sys.version) |
|
sys.exit(1) |
|
else: |
|
print("β
Python version is compatible:", sys.version) |
|
|
|
def install_dependencies(): |
|
print("π¦ Installing dependencies from requirements.txt...") |
|
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"]) |
|
print("β
Dependencies installed.") |
|
|
|
def setup_env_file(): |
|
if not os.path.exists(".env"): |
|
if os.path.exists(".env.example"): |
|
shutil.copy(".env.example", ".env") |
|
print("π .env file created from .env.example. Please edit it and add your OpenAI API key.") |
|
else: |
|
print("β οΈ No .env.example found. Skipping environment setup.") |
|
else: |
|
print("β
.env already exists. Skipping copy.") |
|
|
|
def run_application(): |
|
print("π Running the application...") |
|
subprocess.run([sys.executable, "app.py"]) |
|
|
|
def main(): |
|
print("π οΈ Starting ScriptVoice setup...\n") |
|
check_python_version() |
|
install_dependencies() |
|
setup_env_file() |
|
run_application() |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|