Skip to content

Commit

Permalink
Handle bundled files. Bump to 0.03a
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidCaos committed Sep 10, 2022
1 parent 0ac8a5a commit a948c21
Show file tree
Hide file tree
Showing 20 changed files with 155 additions and 312,840 deletions.
45 changes: 41 additions & 4 deletions build/build.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
@echo off
set NAME=social-emperors_0.02a
pyinstaller --onefile --add-data "..\..\assets;assets" --add-data "..\..\flash;flash" --add-data "..\..\stub;stub" --add-data "..\..\templates;templates" --paths ..\..\. --workpath .\work --distpath .\dist --specpath .\bundle --noconfirm --name %NAME% ..\server.py
echo Done.
pause>NUL
set NAME=social-emperors_0.03a

:main
call :pyInstaller
echo [+] Building Done!
pause>NUL
exit

:pyInstaller
echo [+] Starting pyInstaller...
pyinstaller --onefile ^
--console ^
--add-data "..\..\assets;assets" ^
--add-data "..\..\stub;stub" ^
--add-data "..\..\templates;templates" ^
--add-data "..\..\villages;villages" ^
--add-data "..\..\config;config" ^
--paths ..\..\. ^
--workpath .\work ^
--distpath .\dist ^
--specpath .\bundle ^
--noconfirm ^
--icon=..\icon.ico ^
--name %NAME% ..\server.py
REM --debug bootloader
echo [+] pyInstaller Done.
EXIT /B 0

:clean
echo [+] Cleaning...
rm .\work\*
rm .\work\.*
rmdir .\work
rm .\dist\*
rm .\dist\.*
rmdir .\dist
rm .\bundle\*
rm .\bundle\.*
rmdir .\bundle
echo [+] Cleaning Done.
EXIT /B 0
Binary file added build/icon.ico
Binary file not shown.
21 changes: 21 additions & 0 deletions bundle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import sys
import os

# Bundled data (extracted to a temp dir)

TMP_BUNDLED_DIR = sys._MEIPASS if getattr(sys, 'frozen', None) else "."

ASSETS_DIR = os.path.join(TMP_BUNDLED_DIR, "assets")
STUB_DIR = os.path.join(TMP_BUNDLED_DIR, "stub")
TEMPLATES_DIR = os.path.join(TMP_BUNDLED_DIR, "templates")
VILLAGES_DIR = os.path.join(TMP_BUNDLED_DIR, "villages")
QUESTS_DIR = os.path.join(VILLAGES_DIR, "quests")
CONFIG_DIR = os.path.join(TMP_BUNDLED_DIR, "config")
CONFIG_PATCH_DIR = os.path.join(CONFIG_DIR, "patch")

# Not bundled data (next to server EXE)

BASE_DIR = "."

MODS_DIR = os.path.join(BASE_DIR, "mods")
SAVES_DIR = os.path.join(BASE_DIR, "saves")
Loading

0 comments on commit a948c21

Please sign in to comment.