refactor(release): clean up release build process

* handle case where a dist has never been created
* ignore requirements.txt
* include map resources instead of pulling from submodule
This commit is contained in:
Wrycu 2019-07-10 23:17:52 -07:00
parent ea6b2ab2dc
commit 49795993f1
No known key found for this signature in database
GPG Key ID: BDB10F9DDF6AF8D0
4 changed files with 51 additions and 43 deletions

View File

@ -3,13 +3,14 @@
block_cipher = None block_cipher = None
a = Analysis(['__init__.py'], analysis = Analysis(
pathex=['C:\\Users\\shdwp\\PycharmProjects\\dcs_liberation'], ['__init__.py'],
pathex=['.'],
binaries=[], binaries=[],
datas=[ datas=[
('resources', 'resources'), ('resources', 'resources'),
('submodules/dcs/dcs/terrain/caucasus.p', 'dcs/terrain/'), ('resources/caucasus.p', 'dcs/terrain/'),
('submodules/dcs/dcs/terrain/nevada.p', 'dcs/terrain/'), ('resources/nevada.p', 'dcs/terrain/'),
], ],
hookspath=[], hookspath=[],
runtime_hooks=[], runtime_hooks=[],
@ -17,11 +18,16 @@ a = Analysis(['__init__.py'],
win_no_prefer_redirects=False, win_no_prefer_redirects=False,
win_private_assemblies=False, win_private_assemblies=False,
cipher=block_cipher, cipher=block_cipher,
noarchive=False) noarchive=False,
pyz = PYZ(a.pure, a.zipped_data, )
cipher=block_cipher) pyz = PYZ(
exe = EXE(pyz, analysis.pure,
a.scripts, analysis.zipped_data,
cipher=block_cipher,
)
exe = EXE(
pyz,
analysis.scripts,
[], [],
icon="resources/icon.ico", icon="resources/icon.ico",
exclude_binaries=True, exclude_binaries=True,
@ -30,11 +36,14 @@ exe = EXE(pyz,
bootloader_ignore_signals=False, bootloader_ignore_signals=False,
strip=False, strip=False,
upx=True, upx=True,
console=True ) console=True,
coll = COLLECT(exe, )
a.binaries, coll = COLLECT(
a.zipfiles, exe,
a.datas, analysis.binaries,
analysis.zipfiles,
analysis.datas,
strip=False, strip=False,
upx=True, upx=True,
name='dcs_liberation') name='dcs_liberation',
)

BIN
resources/caucasus.p Normal file

Binary file not shown.

BIN
resources/nevada.p Normal file

Binary file not shown.

View File

@ -7,12 +7,10 @@ from zipfile import *
IGNORED_PATHS = [ IGNORED_PATHS = [
"__pycache__", "__pycache__",
".gitignore", ".gitignore",
".gitmodules",
".git", ".git",
".idea", ".idea",
".DS_Store", ".DS_Store",
"submodules", "requirements.txt",
"build", "build",
"venv", "venv",
] ]
@ -38,15 +36,16 @@ def _zip_dir(archieve, path):
def _mk_archieve(): def _mk_archieve():
path = os.path.join("build", "dcs_liberation_{}.zip".format(VERSION)) path = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, "build", "dcs_liberation_{}.zip".format(VERSION))
if os.path.exists(path): if os.path.exists(path):
print("version already exists") print("version already exists")
return return
try:
shutil.rmtree("./dist") shutil.rmtree("./dist")
except FileNotFoundError:
pass
os.system("pyinstaller.exe pyinstaller.spec") os.system("pyinstaller.exe pyinstaller.spec")
archieve = ZipFile(path, "w") archieve = ZipFile(path, "w")
archieve.writestr("dcs_liberation.bat", "cd dist\\dcs_liberation\r\nliberation_main \"%UserProfile%\\Saved Games\" \"{}\"".format(VERSION)) archieve.writestr("dcs_liberation.bat", "cd dist\\dcs_liberation\r\nliberation_main \"%UserProfile%\\Saved Games\" \"{}\"".format(VERSION))
_zip_dir(archieve, "./dist/dcs_liberation") _zip_dir(archieve, "./dist/dcs_liberation")