#!/usr/bin/env python3 """ Setup script for Tablet Management System """ import subprocess import sys import os def install_dependencies(): """Install required dependencies""" try: # Try to install Flask using pip subprocess.check_call([sys.executable, '-m', 'ensurepip', '--upgrade']) subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'pip']) subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'Flask==2.3.3']) print("✓ Dependencies installed successfully") return True except subprocess.CalledProcessError as e: print(f"✗ Failed to install dependencies: {e}") return False except Exception as e: print(f"✗ Error during installation: {e}") return False def check_dependencies(): """Check if required dependencies are available""" try: import flask import sqlite3 print("✓ All dependencies are available") return True except ImportError as e: print(f"✗ Missing dependency: {e}") return False def main(): print("Setting up Tablet Management System...") # Check if dependencies are already available if not check_dependencies(): print("Installing required dependencies...") if not install_dependencies(): print("\nError: Could not install dependencies.") print("Please install Flask manually:") print(" pip install Flask==2.3.3") print("or") print(" python3 -m pip install Flask==2.3.3") return False print("\nSetup complete!") print("\nTo run the application:") print(" python3 app.py") print("\nThe application will be available at: http://localhost:5000") return True if __name__ == '__main__': success = main() sys.exit(0 if success else 1)