-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
109 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import subprocess | ||
import os | ||
import shutil | ||
|
||
# Definiere den Pfad zum Icon (ändere auf .ico-Datei für Windows) | ||
icon_path = "icon.ico" # Ersetze "icon.ico" durch den tatsächlichen Namen deiner .ico-Datei | ||
|
||
# Schritt 1: PyInstaller ausführen, um eine `.spec`-Datei zu generieren | ||
subprocess.run([ | ||
"pyinstaller", | ||
"--name", "Mastermind", | ||
"--windowed", | ||
"--onedir", | ||
"--noconfirm", # Automatische Bestätigung ohne Nachfragen | ||
"--add-data", "retro.png;.", # Windows verwendet ; statt : | ||
"--add-data", "PressStart2P-Regular.ttf;.", | ||
"--add-data", "config;config", | ||
"--add-data", "gui;gui", | ||
"--add-data", "logic;logic", | ||
"--add-data", "network;network", | ||
"--hidden-import=pkg_resources", | ||
"--hidden-import=pkg_resources.py2_warn", | ||
"--hidden-import=background_manager", | ||
"--hidden-import=config.config", | ||
"--hidden-import=config.game_config", | ||
"--hidden-import=gui.board_view", | ||
"--hidden-import=gui.menu_controller", | ||
"--hidden-import=gui.menu_model", | ||
"--hidden-import=gui.menu_view", | ||
"--hidden-import=gui.menu_view_update", | ||
"--hidden-import=gui.mvc_online_settings.controller", | ||
"--hidden-import=gui.mvc_online_settings.model", | ||
"--hidden-import=gui.mvc_online_settings.view", | ||
"--hidden-import=logic.color_mapping", | ||
"--hidden-import=logic.computer_guesser", | ||
"--hidden-import=logic.computer_local_coder", | ||
"--hidden-import=logic.computer_network_coder", | ||
"--hidden-import=logic.player_coder", | ||
"--hidden-import=logic.player_guesser", | ||
"--hidden-import=pygame_gui", | ||
"--hidden-import=pygame", | ||
"--icon", icon_path, # Pfad zur .ico-Datei hinzufügen | ||
"--specpath", ".", | ||
"main.py" | ||
]) | ||
|
||
# `.spec`-Datei anpassen (nicht notwendig, wenn du die Option richtig übergibst) | ||
spec_file_name = "Mastermind.spec" | ||
with open(spec_file_name, "r") as file: | ||
lines = file.readlines() | ||
|
||
# Anpassungen spezifisch für Windows nicht notwendig, aber du kannst sie hier einfügen, falls erforderlich | ||
|
||
# Speichere die Änderungen in der spec-Datei | ||
with open(spec_file_name, "w") as file: | ||
file.writelines(lines) | ||
|
||
print("Spec-Datei angepasst.") | ||
|
||
# Schritt 3: Angepasste `.spec`-Datei verwenden, um die Anwendung zu bauen | ||
subprocess.run(["pyinstaller", "--noconfirm", spec_file_name]) | ||
|
||
# Schritt 4: Lösche den zusätzlichen Ordner im `dist`-Verzeichnis (optional) | ||
dist_folder = os.path.join("dist", "Mastermind") | ||
if os.path.exists(dist_folder): | ||
shutil.rmtree(dist_folder) | ||
print(f"Ordner '{dist_folder}' wurde gelöscht.") | ||
else: | ||
print(f"Ordner '{dist_folder}' nicht gefunden.") |