mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
55 lines
1.2 KiB
Python
55 lines
1.2 KiB
Python
import os
|
|
import shutil
|
|
|
|
from zipfile import *
|
|
|
|
|
|
IGNORED_PATHS = [
|
|
"__pycache__",
|
|
".gitignore",
|
|
".gitmodules",
|
|
".git",
|
|
".idea",
|
|
".DS_Store",
|
|
"submodules",
|
|
|
|
"build",
|
|
"venv",
|
|
]
|
|
|
|
VERSION = input("version str:")
|
|
|
|
|
|
def _zip_dir(archieve, path):
|
|
for path, directories, files in os.walk(path):
|
|
is_ignored = False
|
|
for ignored_path in IGNORED_PATHS:
|
|
if ignored_path in path:
|
|
is_ignored = True
|
|
break
|
|
|
|
if is_ignored:
|
|
continue
|
|
|
|
for file in files:
|
|
if file in IGNORED_PATHS:
|
|
continue
|
|
archieve.write(os.path.join(path, file))
|
|
|
|
|
|
def _mk_archieve():
|
|
path = os.path.join("build", "dcs_liberation_{}.zip".format(VERSION))
|
|
if os.path.exists(path):
|
|
print("version already exists")
|
|
return
|
|
|
|
shutil.rmtree("./dist")
|
|
|
|
os.system("pyinstaller.exe pyinstaller.spec")
|
|
|
|
archieve = ZipFile(path, "w")
|
|
archieve.writestr("dcs_liberation.bat", "cd dist\\dcs_liberation;\nliberation_main \"%UserProfile%\\Saved Games\" \"{}\"".format(VERSION))
|
|
_zip_dir(archieve, "./dist/dcs_liberation")
|
|
|
|
|
|
_mk_archieve() |