|
|
|
|
|
"""
|
|
|
Script d'installation automatique pour le Bot de Concours Suisse
|
|
|
"""
|
|
|
|
|
|
import subprocess
|
|
|
import sys
|
|
|
import os
|
|
|
|
|
|
def run_command(command, description):
|
|
|
"""Exécute une commande et affiche le résultat"""
|
|
|
print(f"🔄 {description}...")
|
|
|
try:
|
|
|
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
|
|
|
print(f"✅ {description} - Succès")
|
|
|
return True
|
|
|
except subprocess.CalledProcessError as e:
|
|
|
print(f"❌ {description} - Erreur: {e}")
|
|
|
print(f"Output: {e.output}")
|
|
|
return False
|
|
|
|
|
|
def main():
|
|
|
print("🎰 INSTALLATION DU BOT DE CONCOURS SUISSE")
|
|
|
print("=" * 50)
|
|
|
|
|
|
|
|
|
python_version = sys.version_info
|
|
|
if python_version.major < 3 or (python_version.major == 3 and python_version.minor < 8):
|
|
|
print("❌ Python 3.8+ requis. Version actuelle:", sys.version)
|
|
|
return False
|
|
|
|
|
|
print(f"✅ Python {python_version.major}.{python_version.minor} détecté")
|
|
|
|
|
|
|
|
|
if not run_command("pip install -r requirements.txt", "Installation des dépendances Python"):
|
|
|
return False
|
|
|
|
|
|
|
|
|
if not run_command("playwright install chromium", "Installation du navigateur Chromium"):
|
|
|
print("⚠️ Tentative d'installation alternative...")
|
|
|
if not run_command("python -m playwright install chromium", "Installation alternative de Chromium"):
|
|
|
return False
|
|
|
|
|
|
print("\n🎉 INSTALLATION TERMINÉE AVEC SUCCÈS!")
|
|
|
print("\n📖 PROCHAINES ÉTAPES:")
|
|
|
print("1. Modifiez vos informations personnelles dans bot_concours_sans_api.py")
|
|
|
print("2. Lancez le bot avec: python bot_concours_sans_api.py")
|
|
|
print("3. Ou lancez immédiatement avec: python bot_concours_sans_api.py --run-now")
|
|
|
|
|
|
return True
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
success = main()
|
|
|
if not success:
|
|
|
sys.exit(1)
|
|
|
|