Created
January 30, 2026 09:32
-
-
Save apeyroux/a44c54eaf18f3257d2fe550266091e21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from setuphelpers import * | |
| import platform | |
| uninstallkey = [] | |
| def is_linux(): | |
| """Détecte si le système est Linux de manière fiable.""" | |
| return platform.system() == 'Linux' | |
| def is_windows(): | |
| """Détecte si le système est Windows de manière fiable.""" | |
| return platform.system() == 'Windows' | |
| def install(): | |
| """ | |
| Installation du package. | |
| Ce package vérifie le système d'exploitation et ne s'exécute que sur Windows. | |
| Sur Linux, il passe sans rien faire. | |
| """ | |
| current_os = platform.system() | |
| print(f"Système détecté : {current_os}") | |
| if is_linux(): | |
| print("Système Linux détecté - Ce package est destiné à Windows uniquement.") | |
| print("Installation ignorée.") | |
| return # Sort proprement sans erreur | |
| # Code d'installation pour Windows uniquement | |
| print("Système Windows détecté - Exécution de l'installation...") | |
| # Exemple : installer une application | |
| # install_exe_if_needed('mon_application.exe', '/S', 'Mon Application', '1.0.0') | |
| print("Installation terminée avec succès.") | |
| def uninstall(): | |
| """ | |
| Désinstallation du package. | |
| """ | |
| if is_linux(): | |
| print("Système Linux - Rien à désinstaller.") | |
| return | |
| # Code de désinstallation pour Windows | |
| print("Désinstallation en cours...") | |
| def audit(): | |
| """ | |
| Audit du package - vérifie si l'installation est conforme. | |
| Retourne 'OK', 'WARNING' ou 'ERROR' | |
| """ | |
| if is_linux(): | |
| return "OK" # Sur Linux, on considère que c'est OK (non applicable) | |
| # Vérifications pour Windows | |
| return "OK" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment