File size: 2,023 Bytes
37a5673
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python3
"""

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)
    
    # Vérifier Python
    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é")
    
    # Installer les dépendances
    if not run_command("pip install -r requirements.txt", "Installation des dépendances Python"):
        return False
    
    # Installer Playwright browsers
    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)